[lkml]   [2022]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v1 10/15] mm/page-flags: reuse PG_slab as PG_anon_exclusive for PageAnon() pages
On 11.03.22 22:11, Matthew Wilcox wrote:
> On Fri, Mar 11, 2022 at 08:36:37PM +0100, David Hildenbrand wrote:
>> I used PG_error before, but felt like using a bit that is never ever
>> valid to be set/cleared/checked on a subpage would be even a better fit:
>> Note the:
>> PAGEFLAG(Waiters, waiters, PF_ONLY_HEAD) __CLEARPAGEFLAG(Waiters, waiters, PF_ONLY_HEAD)
>> whereby PF_ONLY_HEAD translates to:
>> "for compound page, callers only ever operate on the head page."
>> I can just switch to PG_error, but for the second subpage, PG_waiters
>> should be just fine (unless I am missing something important).
> I think you're missing something important that almost everybody misses
> when looking at this code (including me).
> PF_ANY flags can be set on individual pages.
> PF_HEAD means "we automatically redirect all operations to the head page".
> PF_ONLY_HEAD means "If you try to call this on a tail page, we BUG".
> PF_NO_TAIL means "If you try to read this flag on a tail page, we'll
> look at the head page instead, but if you try to set/clear this flag
> on a tail page, we BUG"

^ that's actually the confusing part for me

"modifications of the page flag must be done on small or head pages,
checks can be done on tail pages too."

Just from reading that I thought checks on the tail page would *not* get
redirected to the head.

I'd have written that as and extended version of PF_HEAD:

"for compound page all operations related to the page flag are applied
to head page. Checks done on a tail page will be redirected to the head


> So really, you can reuse any flag as PF_SECOND that isn't PF_ANY.

I'll go back to PG_error, thanks!


David / dhildenb

 \ /
  Last update: 2022-03-12 09:11    [W:0.089 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site