[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y0gP9i8KZKt4/EcG@dhcp22.suse.cz>
Date: Thu, 13 Oct 2022 15:17:42 +0200
From: Michal Hocko <mhocko@...e.com>
To: Zhongkun He <hezhongkun.hzk@...edance.com>
Cc: corbet@....net, akpm@...ux-foundation.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, linux-api@...r.kernel.org,
linux-doc@...r.kernel.org, wuyun.abel@...edance.com
Subject: Re: [External] Re: [RFC] mm: add new syscall pidfd_set_mempolicy()
On Thu 13-10-22 20:50:48, Zhongkun He wrote:
> > > Hi Michal
> > >
> > > Could we try to change the MPOL_F_SHARED flag to MPOL_F_STATIC to
> > > mark static mempolicy which cannot be freed, and mpol_needs_cond_ref
> > > can use MPOL_F_STATIC to avoid freeing the static mempolicy.
> >
> > Wouldn't it make more sense to get rid of a different treatment and
> > treat all memory policies the same way?
>
> I found a case, not sure if it makes sense. If there is no policy
> in task->mempolicy, the use of atomic_{inc,dec} can be skiped
> according to MPOL_F_STATIC. Atomic_{inc,dec} in hot path may reduces
> performance.
I would start with a simple conversion and do any potential
optimizations on top of that based on actual numbers. Maybe we can
special case default_policy to avoid reference counting a default (no
policy case). A simple check for pol == &default_policy should be
negligible.
--
Michal Hocko
SUSE Labs
Powered by blists - more mailing lists