Re: [PATCH] mm: remove offset check on page->compound_head and folio->lru

From: Wei Yang
Date: Wed Feb 16 2022 - 19:36:20 EST


On Sat, Jan 08, 2022 at 12:49:53AM +0000, Matthew Wilcox wrote:
>On Fri, Jan 07, 2022 at 04:08:25PM -0800, Andrew Morton wrote:
>> On Fri, 7 Jan 2022 22:11:20 +0000 Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
>>
[...]
>> > > Hi, Matthew
>> > >
>> > > Would you mind sharing some insight on this check?
>> >
>> > It's right there in the comments.
>>
>> Well I can't figure out which comment you're referring to?
>
> * WARNING: bit 0 of the first word is used for PageTail(). That
> * means the other users of this union MUST NOT use the bit to
> * avoid collision and false-positive PageTail().
>
>> > If you can't be bothered to read, why should I write?
>>

Hi, Matthew

This change is introduced in commit 1d798ca3f164 'mm: make compound_head()
robust'.

As mentioned in the changelog.

```
That means page->compound_head shares storage space with:

- page->lru.next;
- page->next;
- page->rcu_head.next;
```

We need to make sure those fields in page don't use bit 0 of the word.

So this is an internal guarantee in struct page. I don't see the reason to
compare page->compound_head and folio->lru here.

Maybe I miss something. If you would explain a little, I would appreciate
much.

--
Wei Yang
Help you, Help me