什么是私人页面?

nic*_*c13 5 linux memory kernel linux-kernel

在页面结构中,有一个私有字段。如果我使用 page_buffers() 函数,它们会返回该字段。

还有 PrivatePage()。但我不知道那是什么。

这是什么?

Gil*_*ton 9

参见include/linux/page-flags.h:

 * Private page markings that may be used by the filesystem that owns the page
 * for its own purposes.
 * - PG_private and PG_private_2 cause releasepage() and co to be invoked
Run Code Online (Sandbox Code Playgroud)

还有 Documentation/filesystems/vfs.txt:

地址空间处理程序可以将额外的信息附加到页面,通常使用“结构页面”中的“私有”字段。如果附加了此类信息,则应设置 PG_Private 标志。这将导致各种 VM 例程对地址空间处理程序进行额外的调用来处理该数据。

page_buffers()适用于该private字段包含指向 a 的指针的特定情况struct buffer_head,这是文件系统驱动程序中非常常见的模式。