[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4fe84029-ad5-63cb-f2a7-3c83ea427bf1@google.com>
Date: Tue, 26 Sep 2023 14:36:25 -0700 (PDT)
From: Hugh Dickins <hughd@...gle.com>
To: Matthew Wilcox <willy@...radead.org>
cc: Hugh Dickins <hughd@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Andi Kleen <ak@...ux.intel.com>,
Christoph Lameter <cl@...ux.com>,
Mike Kravetz <mike.kravetz@...cle.com>,
David Hildenbrand <david@...hat.com>,
Suren Baghdasaryan <surenb@...gle.com>,
Yang Shi <shy828301@...il.com>,
Sidhartha Kumar <sidhartha.kumar@...cle.com>,
Vishal Moola <vishal.moola@...il.com>,
Kefeng Wang <wangkefeng.wang@...wei.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Tejun Heo <tj@...nel.org>,
Mel Gorman <mgorman@...hsingularity.net>,
Michal Hocko <mhocko@...e.com>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org
Subject: Re: [PATCH 07/12] mempolicy: mpol_shared_policy_init() without
pseudo-vma
On Mon, 25 Sep 2023, Matthew Wilcox wrote:
> On Mon, Sep 25, 2023 at 01:29:28AM -0700, Hugh Dickins wrote:
> > + /* alloc node covering entire file; adds ref to new */
>
> This comment is confusing. sp_alloc initialises the refcount of 'n' to 1.
> Which is the same memory referred to by the name 'new' in __mpol_dup(),
> but in this function, the name "new" refers to the mempolicy called
> "old" in __mpol_dup().
No promises, but I'll see if I can make it look better in v2.
>
> > + n = sp_alloc(0, MAX_LFS_FILESIZE >> PAGE_SHIFT, new);
> > + if (n)
> > + sp_insert(sp, n);
> > put_new:
> > mpol_put(new); /* drop initial ref */
> > free_scratch:
>
> This is all a bit inefficient, really. We call mpol_new() to get a
> new mpol, then we set it up, then we dup it, then we free it. It'd
> be nice if we could donate it instead of copying it. Maybe you'll
> do something like that later.
"later" is probably the operative word. I do have an unincluded 2017
patch where I had that same realization, and wrote "I suspect that this
series of commits may be adding to an absurdity of over-mpol_dup()ing:
but that's for some other future cleanup, right now I'm just happy not
to be corrupting or leaking mpols."
Hugh
Powered by blists - more mailing lists