linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hugh Dickins <hughd@google.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Palmer Dabbelt <palmer@dabbelt.com>,
	atishp@atishpatra.org, peterz@infradead.org,
	srikar@linux.vnet.ibm.com, valentin.schneider@arm.com,
	vbabka@suse.cz, mpe@ellerman.id.au,
	Palmer Dabbelt <palmerdabbelt@google.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	kernel-team@android.com,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Subject: Re: [PATCH 1/2] mm: Guard a use of node_reclaim_distance with CONFIFG_NUMA
Date: Fri, 26 Feb 2021 17:31:40 -0800 (PST)	[thread overview]
Message-ID: <alpine.LSU.2.11.2102261724370.15322@eggly.anvils> (raw)
In-Reply-To: <20210226123716.6bc2a463e0ee9d1770c7966b@linux-foundation.org>

On Fri, 26 Feb 2021, Andrew Morton wrote:
> On Fri, 26 Feb 2021 12:17:20 -0800 Palmer Dabbelt <palmer@dabbelt.com> wrote:
> > From: Palmer Dabbelt <palmerdabbelt@google.com>
> > 
> > This is only useful under CONFIG_NUMA.  IIUC skipping the check is the
> > right thing to do here, as without CONFIG_NUMA there will never be any
> > large node distances on non-NUMA systems.
> > 
> > I expected this to manifest as a link failure under (!CONFIG_NUMA &&
> > CONFIG_TRANSPARENT_HUGE_PAGES), but I'm not actually seeing that.  I
> > think the reference is just getting pruned before it's checked, but I
> > didn't get that from reading the code so I'm worried I'm missing
> > something.
> > 
> > Either way, this is necessary to guard the definition of
> > node_reclaim_distance with CONFIG_NUMA.
> > 
> > Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
> > ---
> >  mm/khugepaged.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/mm/khugepaged.c b/mm/khugepaged.c
> > index a7d6cb912b05..b1bf191c3a54 100644
> > --- a/mm/khugepaged.c
> > +++ b/mm/khugepaged.c
> > @@ -819,8 +819,10 @@ static bool khugepaged_scan_abort(int nid)
> >  	for (i = 0; i < MAX_NUMNODES; i++) {
> >  		if (!khugepaged_node_load[i])
> >  			continue;
> > +#ifdef CONFIG_NUMA
> >  		if (node_distance(nid, i) > node_reclaim_distance)
> >  			return true;
> > +#endif
> >  	}
> >  	return false;
> >  }
> 
> This makes the entire loop a no-op.  Perhaps Kirill can help take a
> look at removing unnecessary code in khugepaged.c when CONFIG_NUMA=n?

First lines of khugepaged_scan_abort() say
	if (!node_reclaim_mode)
		return false;

And include/linux/swap.h says
#ifdef CONFIG_NUMA
extern int node_reclaim_mode;
extern int sysctl_min_unmapped_ratio;
extern int sysctl_min_slab_ratio;
#else
#define node_reclaim_mode 0
#endif

So, no need for an #ifdef CONFIG_NUMA inside khugepaged_scan_abort().

Hugh

  reply	other threads:[~2021-02-27  1:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-26 20:17 [PATCH 1/2] mm: Guard a use of node_reclaim_distance with CONFIFG_NUMA Palmer Dabbelt
2021-02-26 20:17 ` [PATCH 2/2] topology: Guard " Palmer Dabbelt
2021-02-26 20:37 ` [PATCH 1/2] mm: Guard a use of " Andrew Morton
2021-02-27  1:31   ` Hugh Dickins [this message]
2021-02-27  3:05     ` Palmer Dabbelt
2021-02-27  3:41       ` Hugh Dickins
2021-02-27  4:14         ` Palmer Dabbelt

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.LSU.2.11.2102261724370.15322@eggly.anvils \
    --to=hughd@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=atishp@atishpatra.org \
    --cc=kernel-team@android.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mpe@ellerman.id.au \
    --cc=palmer@dabbelt.com \
    --cc=palmerdabbelt@google.com \
    --cc=peterz@infradead.org \
    --cc=srikar@linux.vnet.ibm.com \
    --cc=valentin.schneider@arm.com \
    --cc=vbabka@suse.cz \
    /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;
as well as URLs for NNTP newsgroup(s).