mbox series

[v3,0/3] mm/mempolicy: some fix and semantics cleanup

Message ID 1622469956-82897-1-git-send-email-feng.tang@intel.com (mailing list archive)
Headers show
Series mm/mempolicy: some fix and semantics cleanup | expand

Message

Feng Tang May 31, 2021, 2:05 p.m. UTC
Hi All,

We've posted v4 patchset introducing a new "perfer-many" memory policy
https://lore.kernel.org/lkml/1615952410-36895-1-git-send-email-feng.tang@intel.com/ ,
for which Michal Hocko gave many comments while pointing out some
problems, and we also found some semantics confusion about 'prefer'
and 'local' policy, as well as some duplicated code. This patchset
tries to address them. Please help to review, thanks!

The patchset has been run with some sanity test like 'stress-ng'
and 'ltp', and no problem found.

Thanks,
Feng

Changelogs:
    v3:
      * fix logic of mpol_rebind_preferred() (Michal Hocko)

    v2:
      * rename mempolicy_nodemask_intersects() to
        mempolicy_in_oom_domain() and correct commit log (Michal Hocko)
      * change the mpol syscall param sanity check (Michal Hocko) 
      * combine the 3/4 and 4/4 in v1 into one patch,
        and further clean the logic (Michal Hocko)

    v1:
      * use helper func instead of macro for patch 2/4 (David Rientjes)
      * fix a possible null pointer case in patch 3/4 		
      * update commit log for 1/4
      
    RFC v2:
      * add for oom check fix patch 1/4
      * add the unification patch for mpol preprocess 2/4

Feng Tang (3):
  mm/mempolicy: cleanup nodemask intersection check for oom
  mm/mempolicy: don't handle MPOL_LOCAL like a fake MPOL_PREFERRED
    policy
  mm/mempolicy: unify the parameter sanity check for mbind and
    set_mempolicy

 include/linux/mempolicy.h      |   2 +-
 include/uapi/linux/mempolicy.h |   1 -
 mm/mempolicy.c                 | 212 ++++++++++++++++++-----------------------
 mm/oom_kill.c                  |   2 +-
 4 files changed, 95 insertions(+), 122 deletions(-)

Comments

Andrew Morton May 31, 2021, 9:41 p.m. UTC | #1
On Mon, 31 May 2021 22:05:53 +0800 Feng Tang <feng.tang@intel.com> wrote:

> We've posted v4 patchset introducing a new "perfer-many" memory policy
> https://lore.kernel.org/lkml/1615952410-36895-1-git-send-email-feng.tang@intel.com/ ,
> for which Michal Hocko gave many comments while pointing out some
> problems, and we also found some semantics confusion about 'prefer'
> and 'local' policy, as well as some duplicated code. This patchset
> tries to address them. Please help to review, thanks!
> 
> The patchset has been run with some sanity test like 'stress-ng'
> and 'ltp', and no problem found.

None of the above is suitable for the [0/n] overall description.  I
copied-n-pasted the v1 cover letter from the above link.  Please check
that it is all still correct and up to date.  If not, please send along
replacement text, thanks.
Feng Tang June 1, 2021, 12:55 a.m. UTC | #2
Hi Andrew,

Thanks for reviewing and taking the patches.

On Mon, May 31, 2021 at 02:41:28PM -0700, Andrew Morton wrote:
> On Mon, 31 May 2021 22:05:53 +0800 Feng Tang <feng.tang@intel.com> wrote:
> 
> > We've posted v4 patchset introducing a new "perfer-many" memory policy
> > https://lore.kernel.org/lkml/1615952410-36895-1-git-send-email-feng.tang@intel.com/ ,
> > for which Michal Hocko gave many comments while pointing out some
> > problems, and we also found some semantics confusion about 'prefer'
> > and 'local' policy, as well as some duplicated code. This patchset
> > tries to address them. Please help to review, thanks!
> > 
> > The patchset has been run with some sanity test like 'stress-ng'
> > and 'ltp', and no problem found.
> 
> None of the above is suitable for the [0/n] overall description.  I
> copied-n-pasted the v1 cover letter from the above link.  Please check
> that it is all still correct and up to date.  If not, please send along
> replacement text, thanks.

I should make the cover-letter more descriptive. The link above is another
patchset to introduce a new memory policy MPOL_PREFERRED_MANY, while these
3 patches are preparation work for it, to make it easier for a new policy
to be hooked in.

So how about the following text:

Current memory policy code has some confusing and ambiguous part about
MPOL_LOCAL policy, as it is handled as a faked MPOL_PREFERRED one, and
there are many places having to distinguish them. Also the nodemask
intersection check needs cleanup to be more explicit for OOM use, and
handle MPOL_INTERLEAVE correctly. This patchset cleans up these and
unifies the parameter sanity check for mbind() and set_mempolicy().

Please feel free to modify it, thanks!

- Feng
Michal Hocko June 1, 2021, 8:48 a.m. UTC | #3
On Tue 01-06-21 08:55:13, Feng Tang wrote:
[...]
> Current memory policy code has some confusing and ambiguous part about
> MPOL_LOCAL policy, as it is handled as a faked MPOL_PREFERRED one, and
> there are many places having to distinguish them. Also the nodemask
> intersection check needs cleanup to be more explicit for OOM use, and
> handle MPOL_INTERLEAVE correctly. This patchset cleans up these and
> unifies the parameter sanity check for mbind() and set_mempolicy().

Looks good to me. I would just add that this cleanup helps to make
further changes easier (notably MPOL_PREFERRED_MANY)