Skip to contentSkip to conversation

Reclaiming PG_private

RFC Matthew Wilcox 2 participants 2 messages Apr 22, 2021 – Apr 23, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

We're perenially short of page flags, and I don't really see the need for PG_private to exist. We have 32/64 bits available in page->private, and we don't seem to need the extra bit.

Most users store a pointer in page->private, and so PagePrivate() being implemented as page->private != 0 is appropriate.

Some users simply SetPagePrivate() and don't touch page->private. Those users could instead set page->private to 1.

Do we have any users which want to SetPagePrivate() and want to put a meaningful zero value in page->private?

AFS stores a pair of integers in page->private, but the second integer must be greater than the first one, so they can't both be zero. btrfs stores a real or fake pointer. buffer_head filesystems generally store a buffer_head pointer. fscrypt stores a pointer. erofs stores a real or fake pointer. f2fs does set PagePrivate and also set the pointer to NULL, but it's not clear whether that's intentional. iomap stores a pointer. jfs stores a pointer. nfs stores a pointer. ntfs stores a pointer. orangefs stores a pointer.

So ... what's going on with f2fs? Does it need to distinguish between a page which has f2fs_set_page_private(page, 0) called on it, and a page which has had f2fs_clear_page_private() called on it?

#1 lore raw
Quoted 3 lines · Matthew Wilcox

So ... what's going on with f2fs? Does it need to distinguish between a page which has f2fs_set_page_private(page, 0) called on it, and a page which has had f2fs_clear_page_private() called on it?

Yes, its intention here is just using Pageprivate to indicate there is some reference counts related to a dirty page, so value in page.private is meaningless.

I guess we can avoid f2fs_set_page_private(page, 0) usage, instead, try to use SetPagePrivate() and assign page.private with non-zero value at the time.

Thanks,