linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Rik van Riel <riel@surriel.com>
To: Waiman Long <longman@redhat.com>, Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org,  linux-mm@kvack.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Phil Auld <pauld@redhat.com>, Andy Lutomirski <luto@kernel.org>
Subject: Re: [PATCH v2] sched/core: Don't use dying mm as active_mm of kthreads
Date: Mon, 29 Jul 2019 12:12:14 -0400	[thread overview]
Message-ID: <89d6acc3cc5d72f750f1a77164043dbfd6e599e8.camel@surriel.com> (raw)
In-Reply-To: <c2dfc884-b3e1-6fb3-b05f-2b1f299853f4@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2163 bytes --]

On Mon, 2019-07-29 at 11:37 -0400, Waiman Long wrote:
> On 7/29/19 11:03 AM, Peter Zijlstra wrote:
> > On Mon, Jul 29, 2019 at 10:51:51AM -0400, Waiman Long wrote:
> > > On 7/29/19 4:52 AM, Peter Zijlstra wrote:
> > > > On Sat, Jul 27, 2019 at 01:10:47PM -0400, Waiman Long wrote:
> > > > > It was found that a dying mm_struct where the owning task has
> > > > > exited
> > > > > can stay on as active_mm of kernel threads as long as no
> > > > > other user
> > > > > tasks run on those CPUs that use it as active_mm. This
> > > > > prolongs the
> > > > > life time of dying mm holding up memory and other resources
> > > > > like swap
> > > > > space that cannot be freed.
> > > > Sure, but this has been so 'forever', why is it a problem now?
> > > I ran into this probem when running a test program that keeps on
> > > allocating and touch memory and it eventually fails as the swap
> > > space is
> > > full. After the failure, I could not rerun the test program again
> > > because the swap space remained full. I finally track it down to
> > > the
> > > fact that the mm stayed on as active_mm of kernel threads. I have
> > > to
> > > make sure that all the idle cpus get a user task to run to bump
> > > the
> > > dying mm off the active_mm of those cpus, but this is just a
> > > workaround,
> > > not a solution to this problem.
> > The 'sad' part is that x86 already switches to init_mm on idle and
> > we
> > only keep the active_mm around for 'stupid'.
> > 
> > Rik and Andy were working on getting that 'fixed' a while ago, not
> > sure
> > where that went.
> 
> Good, perhaps the right thing to do is for the idle->kernel case to
> keep
> init_mm as the active_mm instead of reuse whatever left behind the
> last
> time around.

Absolutely not. That creates heavy cache line
contention on the mm_cpumask as we switch the
mm out and back in after an idle period.

The cache line contention on the mm_cpumask
alone can take up as much as a percent of
CPU time on a very busy system with a large
multi-threaded application, multiple sockets,
and lots of context switches.

-- 
All Rights Reversed.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2019-07-29 16:12 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-27 17:10 Waiman Long
2019-07-29  8:18 ` Qais Yousef
2019-07-29 21:06   ` Waiman Long
2019-07-29 21:33     ` Qais Yousef
2019-07-29  8:52 ` Peter Zijlstra
2019-07-29 14:24   ` [PATCH] sched: Clean up active_mm reference counting Peter Zijlstra
2019-07-29 15:01     ` Mathieu Desnoyers
2019-07-29 15:16     ` Waiman Long
2019-07-29 15:22       ` Peter Zijlstra
2019-07-29 15:29     ` Rik van Riel
2019-07-29 14:27   ` [PATCH v2] sched/core: Don't use dying mm as active_mm of kthreads Peter Zijlstra
2019-07-29 15:22     ` Waiman Long
2019-07-29 15:38       ` Peter Zijlstra
2019-07-29 14:51   ` Waiman Long
2019-07-29 15:03     ` Peter Zijlstra
2019-07-29 15:28       ` Rik van Riel
2019-07-29 15:44         ` Peter Zijlstra
2019-07-29 16:10           ` Rik van Riel
2019-07-29 16:26             ` Peter Zijlstra
2019-07-29 15:37       ` Waiman Long
2019-07-29 16:12         ` Rik van Riel [this message]
2019-07-29 16:22       ` Andy Lutomirski
2019-07-29  9:12 ` Michal Hocko
2019-07-29 15:27   ` Waiman Long
2019-07-29 18:58     ` Michal Hocko
2019-07-29 20:41       ` Waiman Long

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=89d6acc3cc5d72f750f1a77164043dbfd6e599e8.camel@surriel.com \
    --to=riel@surriel.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=longman@redhat.com \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=pauld@redhat.com \
    --cc=peterz@infradead.org \
    /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