All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mel Gorman <mgorman@techsingularity.net>
To: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>, Jirka Hladky <jhladky@redhat.com>,
	Rik van Riel <riel@surriel.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux-MM <linux-mm@kvack.org>
Subject: Re: [PATCH 2/2] mm, numa: Migrate pages to local nodes quicker early in the lifetime of a task
Date: Tue, 2 Oct 2018 14:54:59 +0100	[thread overview]
Message-ID: <20181002135459.GA7003@techsingularity.net> (raw)
In-Reply-To: <20181002124149.GB4593@linux.vnet.ibm.com>

On Tue, Oct 02, 2018 at 06:11:49PM +0530, Srikar Dronamraju wrote:
> >
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index 25c7c7e09cbd..7fc4a371bdd2 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -1392,6 +1392,17 @@ bool should_numa_migrate_memory(struct task_struct *p, struct page * page,
> >  	int last_cpupid, this_cpupid;
> >
> >  	this_cpupid = cpu_pid_to_cpupid(dst_cpu, current->pid);
> > +	last_cpupid = page_cpupid_xchg_last(page, this_cpupid);
> > +
> > +	/*
> > +	 * Allow first faults or private faults to migrate immediately early in
> > +	 * the lifetime of a task. The magic number 4 is based on waiting for
> > +	 * two full passes of the "multi-stage node selection" test that is
> > +	 * executed below.
> > +	 */
> > +	if ((p->numa_preferred_nid == -1 || p->numa_scan_seq <= 4) &&
> > +	    (cpupid_pid_unset(last_cpupid) || cpupid_match_pid(p, last_cpupid)))
> > +		return true;
> >
> 
> This does have issues when using with workloads that access more shared faults
> than private faults.
> 

Not as such. It can have issues on workloads where memory is initialised
by one thread, then additional threads are created and access the same
memory. They are not necessarily shared once buffers are handed over. In
such a case, migrating quickly is the right thing to do. If it's truely
shared pages then there may be some unnecessary migrations early in the
lifetime of the task but it'll settle down quickly enough.

> In such workloads, this change would spread the memory causing regression in
> behaviour.
> 
> 5 runs of on 2 socket/ 4 node power 8 box
> 
> 
> Without this patch
> ./numa01.sh      Real:  382.82    454.29    422.31    29.72
> ./numa01.sh      Sys:   40.12     74.53     58.50     13.37
> ./numa01.sh      User:  34230.22  46398.84  40292.62  4915.93
> 
> With this patch
> ./numa01.sh      Real:  415.56    555.04    473.45    51.17    -10.8016%
> ./numa01.sh      Sys:   43.42     94.22     73.59     17.31    -20.5055%
> ./numa01.sh      User:  35271.95  56644.19  45615.72  7165.01  -11.6694%
> 
> Since we are looking at time, smaller numbers are better.
> 

Is it just numa01 that was affected for you? I ask because that particular
workload is an averse workload on any machine with more than sockets and
your machine description says it has 4 nodes. What it is testing is quite
specific to 2-node machines.

> SPECJbb did show some small loss and gains.
> 

That almost always shows small gains and losses so that's not too
surprising.

> Our numa grouping is not fast enough. It can take sometimes several
> iterations before all the tasks belonging to the same group end up being
> part of the group. With the current check we end up spreading memory faster
> than we should hence hurting the chance of early consolidation.
> 
> Can we restrict to something like this?
> 
> if (p->numa_scan_seq >=MIN && p->numa_scan_seq <= MIN+4 &&
>     (cpupid_match_pid(p, last_cpupid)))
> 	return true;
> 
> meaning, we ran atleast MIN number of scans, and we find the task to be most likely
> task using this page.
> 

What's MIN? Assuming it's any type of delay, note that this will regress
STREAM again because it's very sensitive to the starting state.

-- 
Mel Gorman
SUSE Labs

  reply	other threads:[~2018-10-02 13:55 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-01 10:05 [PATCH 0/2] Faster migration for automatic NUMA balancing Mel Gorman
2018-10-01 10:05 ` [PATCH 1/2] mm, numa: Remove rate-limiting of automatic numa balancing migration Mel Gorman
2018-10-01 15:39   ` Rik van Riel
2018-10-02 10:17   ` [tip:sched/urgent] mm, sched/numa: Remove rate-limiting of automatic NUMA " tip-bot for Mel Gorman
2018-10-02 11:54   ` [PATCH 1/2] mm, numa: Remove rate-limiting of automatic numa " Srikar Dronamraju
2018-10-01 10:05 ` [PATCH 2/2] mm, numa: Migrate pages to local nodes quicker early in the lifetime of a task Mel Gorman
2018-10-01 15:41   ` Rik van Riel
2018-10-02 10:17   ` [tip:sched/urgent] sched/numa: " tip-bot for Mel Gorman
2018-10-02 12:41   ` [PATCH 2/2] mm, numa: " Srikar Dronamraju
2018-10-02 13:54     ` Mel Gorman [this message]
2018-10-02 17:30       ` Srikar Dronamraju
2018-10-02 18:22         ` Mel Gorman
2018-10-03 13:15           ` Srikar Dronamraju
2018-10-03 13:07         ` Srikar Dronamraju
2018-10-03 13:21           ` Mel Gorman
2018-10-03 14:08             ` Srikar Dronamraju

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=20181002135459.GA7003@techsingularity.net \
    --to=mgorman@techsingularity.net \
    --cc=jhladky@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=riel@surriel.com \
    --cc=srikar@linux.vnet.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.