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

Vlastimil Babka
2022-01-25T10:15:03Z

On 1/24/22 23:55, Wei Yang wrote:
> On Mon, Jan 24, 2022 at 11:30:10AM +0100, Vlastimil Babka wrote:
>>On 1/23/22 02:38, Wei Yang wrote:
>>> On Sat, Jan 08, 2022 at 08:13:40AM +0000, Wei Yang wrote:
>>>>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:
>>>>
>>>>To me, if folio has the same layout of page, folio meets this requirement. I
>>>>still not catch the point why we need this check here.
>>>>
>>>
>>> Hi, Matthew
>>>
>>> Are you back from vocation? If you could give more insight on this check, I
>>> would be appreciated.
>>
>>I can offer my insight (which might be of course wrong). Ideally one day
>>page.lru will be gone and only folio will be used for LRU pages. Then there
>>won't be a FOLIO_MATCH(lru, lru); and FOLIO_MATCH(compound_head, lru);
>>won't appear to be redundant anymore. lru is list_head so two pointers and
>
> Thanks for your comment.
>
> I can't imagine the final result. If we would remove page.lru, we could remove
> FOLIO_MATCH(lru, lru) and add FOLIO_MATCH(compound_head, lru) at that moment?

Yes, or we could forget to do it. Adding it right now is another option that
Matthew has chosen and I don't see a strong reason to change it. Can you
measure a kernel build speedup thanks to removing the now redundant check?

>>thus valid pointers are aligned in such a way they can't accidentaly set the
>>bit 0.
>>
>