linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Rientjes <rientjes@google.com>
To: Dave Hansen <dave.hansen@intel.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>,
	linux-kernel@vger.kernel.org,  linux-mm@kvack.org,
	alex.shi@linux.alibaba.com, dwagner@suse.de,  tobin@kernel.org,
	cl@linux.com, akpm@linux-foundation.org,  ying.huang@intel.com,
	dan.j.williams@intel.com, cai@lca.pw
Subject: Re: [PATCH 3/3] mm/vmscan: replace implicit RECLAIM_ZONE checks with explicit checks
Date: Wed, 1 Jul 2020 15:01:14 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.2.23.453.2007011457250.1942091@chino.kir.corp.google.com> (raw)
In-Reply-To: <0dd57932-44cf-0c2d-e157-07a8d7324006@intel.com>

On Wed, 1 Jul 2020, Dave Hansen wrote:

> On 7/1/20 1:04 PM, Ben Widawsky wrote:
> >> +static inline bool node_reclaim_enabled(void)
> >> +{
> >> +	/* Is any node_reclaim_mode bit set? */
> >> +	return node_reclaim_mode & (RECLAIM_ZONE|RECLAIM_WRITE|RECLAIM_UNMAP);
> >> +}
> >> +
> >>  extern void check_move_unevictable_pages(struct pagevec *pvec);
> >>  
> >>  extern int kswapd_run(int nid);
> > If a user writes a bit that isn't a RECLAIM_* bit to vm.zone_reclaim_mode 
> > today, it acts as though RECLAIM_ZONE is enabled: we try to reclaim in 
> > zonelist order before falling back to the next zone in the page allocator.  
> > The sysctl doesn't enforce any max value :/  I dont know if there is any 
> > such user, but this would break them if there is.
> > 
> > Should this simply be return !!node_reclaim_mode?
> 
> You're right that there _could_ be a user-visible behavior change here.
>  But, if there were a change it would be for a bit which wasn't even
> mentioned in the documentation.  Somebody would have had to look at the
> doc mentioning 1,2,4 and written an 8.  If they did that, they're asking
> for trouble because we could have defined the '8' bit to do nasty things
> like auto-demote all your memory. :)
> 
> I'll mention it in the changelog, but I still think we should check the
> actual, known bits rather than check for 0.
> 
> BTW, in the hardware, they almost invariably make unused bits "reserved"
> and do mean things like #GP if someone tries to set them.  This is a
> case where the kernel probably should have done the same.  It would have
> saved us the trouble of asking these questions now.  Maybe we should
> even do that going forward.
> 

Maybe enforce it in a sysctl handler so the user catches any errors, which 
would be better than silently accepting some policy that doesn't exist?

RECLAIM_UNMAP and/or RECLAIM_WRITE should likely get -EINVAL if attempted 
to be set without RECLAIM_ZONE as well: they are no-ops without 
RECLAIM_ZONE.  This would likely have caught something wrong with commit 
648b5cf368e0 ("mm/vmscan: remove unused RECLAIM_OFF/RECLAIM_ZONE") if it 
would have already been in place.

I don't feel strongly about this, so feel free to ignore.


  reply	other threads:[~2020-07-01 22:01 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-01 15:26 [PATCH 0/3] [v2] Repair and clean up vm.zone_reclaim_mode sysctl ABI Dave Hansen
2020-07-01 15:26 ` [PATCH 1/3] mm/vmscan: restore zone_reclaim_mode ABI Dave Hansen
2020-07-01 20:03   ` David Rientjes
2020-07-02 11:28   ` Huang, Ying
2020-07-02 14:36     ` Dave Hansen
2020-07-01 15:26 ` [PATCH 2/3] mm/vmscan: move RECLAIM* bits to uapi header Dave Hansen
2020-07-01 15:46   ` Ben Widawsky
2020-07-01 15:56     ` Dave Hansen
2020-07-01 20:03   ` David Rientjes
2020-07-01 15:26 ` [PATCH 3/3] mm/vmscan: replace implicit RECLAIM_ZONE checks with explicit checks Dave Hansen
2020-07-01 20:03   ` David Rientjes
2020-07-01 20:04     ` Ben Widawsky
2020-07-01 21:29       ` Dave Hansen
2020-07-01 22:01         ` David Rientjes [this message]
2020-07-01 16:00 ` [PATCH 0/3] [v2] Repair and clean up vm.zone_reclaim_mode sysctl ABI Ben Widawsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.23.453.2007011457250.1942091@chino.kir.corp.google.com \
    --to=rientjes@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex.shi@linux.alibaba.com \
    --cc=cai@lca.pw \
    --cc=cl@linux.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=dwagner@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=tobin@kernel.org \
    --cc=ying.huang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox