[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <85016E74-E7D6-4AA1-8754-24B86496CEFE@linux.dev>
Date: Thu, 22 Jan 2026 19:52:52 +0800
From: Muchun Song <muchun.song@...ux.dev>
To: Kiryl Shutsemau <kas@...nel.org>,
Zi Yan <ziy@...dia.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
David Hildenbrand <david@...nel.org>,
Matthew Wilcox <willy@...radead.org>,
Usama Arif <usamaarif642@...il.com>,
Frank van der Linden <fvdl@...gle.com>,
Oscar Salvador <osalvador@...e.de>,
Mike Rapoport <rppt@...nel.org>,
Vlastimil Babka <vbabka@...e.cz>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
Baoquan He <bhe@...hat.com>,
Michal Hocko <mhocko@...e.com>,
Johannes Weiner <hannes@...xchg.org>,
Jonathan Corbet <corbet@....net>,
kernel-team@...a.com,
linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
linux-doc@...r.kernel.org
Subject: Re: [PATCHv4 05/14] mm: Rework compound_head() for power-of-2
sizeof(struct page)
> On Jan 22, 2026, at 19:29, Kiryl Shutsemau <kas@...nel.org> wrote:
>
> On Wed, Jan 21, 2026 at 12:12:13PM -0500, Zi Yan wrote:
>>> @@ -1244,8 +1244,8 @@ void snapshot_page(struct page_snapshot *ps, const struct page *page)
>>> again:
>>> memset(&ps->folio_snapshot, 0, sizeof(struct folio));
>>> memcpy(&ps->page_snapshot, page, sizeof(*page));
>>> - head = ps->page_snapshot.compound_info;
>>> - if ((head & 1) == 0) {
>>> + info = ps->page_snapshot.compound_info;
>>> + if ((info & 1) == 0) {
>>
>> This could be “if (!(info & 1))” like _compound_head(), right?
>
> Right. But I don't see why it has to change.
Let me briefly explain my programming habits. I guess this might
be Zi Yan's idea.
When I use a variable as a boolean type, my habit is to use the
"!var" operator to check if it is 0 (false). When I use a variable
as a number (with a value range exceeding 0 and 1), and I need to
check if this variable is 0, I usually use "var == 0".
The least significant bit here seems to be used as a boolean type.
>
>
> --
> Kiryl Shutsemau / Kirill A. Shutemov
Powered by blists - more mailing lists