[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ef1e285c-187a-f682-a62b-c6a0f42b5cbf@google.com>
Date: Tue, 15 Feb 2022 13:02:30 -0800 (PST)
From: Hugh Dickins <hughd@...gle.com>
To: Matthew Wilcox <willy@...radead.org>
cc: Hugh Dickins <hughd@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Michal Hocko <mhocko@...e.com>,
Vlastimil Babka <vbabka@...e.cz>,
"Kirill A. Shutemov" <kirill@...temov.name>,
David Hildenbrand <david@...hat.com>,
Alistair Popple <apopple@...dia.com>,
Johannes Weiner <hannes@...xchg.org>,
Rik van Riel <riel@...riel.com>,
Suren Baghdasaryan <surenb@...gle.com>,
Yu Zhao <yuzhao@...gle.com>, Greg Thelen <gthelen@...gle.com>,
Shakeel Butt <shakeelb@...gle.com>,
Yang Li <yang.lee@...ux.alibaba.com>,
SeongJae Park <sj@...nel.org>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH v2 10/13] mm/munlock: mlock_page() munlock_page() batch
by pagevec
On Tue, 15 Feb 2022, Matthew Wilcox wrote:
> On Mon, Feb 14, 2022 at 06:37:29PM -0800, Hugh Dickins wrote:
> > +/*
> > + * Flags held in the low bits of a struct page pointer on the mlock_pvec.
> > + */
> > +#define LRU_PAGE 0x1
> > +#define NEW_PAGE 0x2
> > +#define mlock_lru(page) ((struct page *)((unsigned long)page + LRU_PAGE))
> > +#define mlock_new(page) ((struct page *)((unsigned long)page + NEW_PAGE))
>
> You've tripped over one of the weirdnesses in the C preprocessor here.
> If the variable passed is not _named_ page, it gets cast to a pointer
> to a struct of the same name as the variable. There's no way to tell
> cpp that that 'page' after 'struct' is literal and not to be replaced
> by the 'page' argument.
>
> I'm going to change this to:
>
> static inline struct page *mlock_lru(struct page *page)
> {
> return (struct page *)((unsigned long)page + LRU_PAGE);
> }
>
> (mutatis mutandi for mlock_new)
Okay, thanks. (You're not naming your folio "page" :-?)
Hugh
Powered by blists - more mailing lists