[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <56e5c740-2eaa-daa5-3df9-369f4d8be34a@google.com>
Date: Thu, 10 Dec 2020 15:46:55 -0800 (PST)
From: David Rientjes <rientjes@...gle.com>
To: Vlastimil Babka <vbabka@...e.cz>
cc: Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, Christoph Lameter <cl@...ux.com>,
Pekka Enberg <penberg@...nel.org>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
Matthew Wilcox <willy@...radead.org>
Subject: Re: [PATCH] mm, slab, slub: clear the slab_cache field when freeing
page
On Thu, 10 Dec 2020, Vlastimil Babka wrote:
> The page allocator expects that page->mapping is NULL for a page being freed.
> SLAB and SLUB use the slab_cache field which is in union with mapping, but
> before freeing the page, the field is referenced with the "mapping" name when
> set to NULL.
>
> It's IMHO more correct (albeit functionally the same) to use the slab_cache
> name as that's the field we use in SL*B, and document why we clear it in a
> comment (we don't clear fields such as s_mem or freelist, as page allocator
> doesn't care about those). While using the 'mapping' name would automagically
> keep the code correct if the unions in struct page changed, such changes should
> be done consciously and needed changes evaluated - the comment should help with
> that.
>
> Signed-off-by: Vlastimil Babka <vbabka@...e.cz>
Acked-by: David Rientjes <rientjes@...gle.com>
Powered by blists - more mailing lists