lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210527133436.GD7743@shbuild999.sh.intel.com>
Date:   Thu, 27 May 2021 21:34:36 +0800
From:   Feng Tang <feng.tang@...el.com>
To:     Michal Hocko <mhocko@...e.com>
Cc:     linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>,
        David Rientjes <rientjes@...gle.com>,
        Dave Hansen <dave.hansen@...el.com>,
        Ben Widawsky <ben.widawsky@...el.com>,
        linux-kernel@...r.kernel.org,
        Andrea Arcangeli <aarcange@...hat.com>,
        Mel Gorman <mgorman@...hsingularity.net>,
        Mike Kravetz <mike.kravetz@...cle.com>,
        Randy Dunlap <rdunlap@...radead.org>,
        Vlastimil Babka <vbabka@...e.cz>,
        Andi Kleen <ak@...ux.intel.com>,
        Dan Williams <dan.j.williams@...el.com>, ying.huang@...el.com
Subject: Re: [PATCH v1 4/4] mm/mempolicy: kill MPOL_F_LOCAL bit

On Thu, May 27, 2021 at 02:26:24PM +0200, Michal Hocko wrote:
> On Thu 27-05-21 20:10:41, Feng Tang wrote:
> > On Thu, May 27, 2021 at 10:20:08AM +0200, Michal Hocko wrote:
> > > On Wed 26-05-21 13:01:42, Feng Tang wrote:
> > > > Now the only remaining case of a real 'local' policy faked by
> > > > 'prefer' policy plus MPOL_F_LOCAL bit is:
> > > > 
> > > > A valid 'prefer' policy with a valid 'preferred' node is 'rebind'
> > > > to a nodemask which doesn't contains the 'preferred' node, then it
> > > > will handle allocation with 'local' policy.
> > > > 
> > > > Add a new 'MPOL_F_LOCAL_TEMP' bit for this case, and kill the
> > > > MPOL_F_LOCAL bit, which could simplify the code much.
> > > 
> > > As I've pointed out in the reply to the previous patch. It would have
> > > been much better if most of the MPOL_F_LOCAL usage was gone by this
> > > patch.
> > > 
> > > I also dislike a new MPOL_F_LOCAL_TEMP. This smells like sneaking the
> > > hack back in after you have painstakingly removed it. So this looks like
> > > a step backwards to me. I also do not understand why do we need the
> > > rebind callback for local policy at all. There is no node mask for local
> > > so what is going on here?
> > 
> > This is the special case 4 for 'perfer' policy with MPOL_F_STATIC_NODES
> > flag set, say it prefer node 1, when it is later 'refind' to a new
> > nodemask node 2-3, according to current code it will be add the
> > MPOL_F_LOCAL bit and performs 'local' policy acctually. And in future
> > it is 'rebind' again with a nodemask 1-2, it will be restored back
> > to 'prefer' policy with preferred node 1.
> 
> Honestly I still do not follow the actual problem. 

I was confused too, and don't know the original thought behind it. This
case 4 was just imagined by reading the code.

> A preferred node is a
> _hint_. If you rebind the task to a different cpuset then why should we
> actually care? The allocator will fallback to the closest node according
> to the distance metric. Maybe the original code was trying to handle
> that in some way but I really do fail to understand that code and I
> strongly suspect it is more likely to overengineered rather than backed
> by a real usecase. I might be wrong here but then this is an excellent
> opportunity to clarify all those subtleties.

>From the code, the original special handling may be needed in 3 cases:
    get_policy_nodemask()
    policy_node()
    mempolicy_slab_node()
to not return the preset prefer_nid.

Thanks,
Feng

> -- 
> Michal Hocko
> SUSE Labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ