public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: balbir@linux.vnet.ibm.com
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	linux-kernel@vger.kernel.org,
	Nick Piggin <nickpiggin@yahoo.com.au>,
	Rik van Riel <riel@redhat.com>
Subject: Re: [RFC][PATCH] mm: couple rcu and memory reclaim
Date: Mon, 24 Sep 2007 13:06:16 +0200	[thread overview]
Message-ID: <20070924130616.4141a084@twins> (raw)
In-Reply-To: <46F7948B.7000802@linux.vnet.ibm.com>

On Mon, 24 Sep 2007 16:12:19 +0530 Balbir Singh
<balbir@linux.vnet.ibm.com> wrote:

> Peter Zijlstra wrote:
> > 
> > Just an idea I had, it seems like a good idea to wait for RCU callbacks
> > in reclaim so that we won't get all of memory stuck there.
> > 
> > If this location is too aggressive we might stick it next to
> > disable_swap_token().
> > 
> > ---
> > Couple RCU and reclaim.
> > 
> > There could be a lot of memory stuck in RCU callbacks. Wait for RCU to
> > finish before giving it another go.
> > 
> > Placed in kswapd and not direct reclaim path because kswapd never holds
> > rcu_read_lock() at this point and can thus not deadlock. Direct reclaim
> > callers might hold rcu_read_lock() and would suffer from deadlocks if
> > sync_rcu() were to be called.
> > 
> > Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> > ---
> >  mm/vmscan.c |    4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > Index: linux-2.6/mm/vmscan.c
> > ===================================================================
> > --- linux-2.6.orig/mm/vmscan.c
> > +++ linux-2.6/mm/vmscan.c
> > @@ -1435,8 +1435,10 @@ loop_again:
> >  		unsigned long lru_pages = 0;
> > 
> >  		/* The swap token gets in the way of swapout... */
> > -		if (!priority)
> > +		if (!priority) {
> > +			synchronize_rcu();

Bah, it seems I send the wrong patch out :-/

this is the one against disable_swap_token(). I meant to send out this
one:

@@ -1527,8 +1527,10 @@ loop_again:
                 * OK, kswapd is getting into trouble.  Take a nap, then take
                 * another pass across the zones.
                 */
-               if (total_scanned && priority < DEF_PRIORITY - 2)
+               if (total_scanned && priority < DEF_PRIORITY - 2) {
+                       synchronize_rcu();
                        congestion_wait(WRITE, HZ/10);
+               }

 
> Interesting change
> 
> 1. I suspect that synchronize_rcu() is most likely to free up
>    slab pages, so shrink_slab() will clean up all the freed
>    pages. Could we add a comment to indicate the same?

Yes indeed, will add such a comment.

> 2. Shouldn't we do this in balance_pgdat() as well?

Uhm, this is balance_pgdat() (both these changes) :-)

Only kswapd can do this, direct reclaim has deadlock potential.

  reply	other threads:[~2007-09-24 11:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-24  8:45 [RFC][PATCH] mm: couple rcu and memory reclaim Peter Zijlstra
2007-09-24 10:42 ` Balbir Singh
2007-09-24 11:06   ` Peter Zijlstra [this message]
2007-09-24 11:22     ` Balbir Singh
2007-09-24 11:50       ` Peter Zijlstra
2007-09-24 12:48         ` Balbir Singh
2007-09-24 12:58           ` Peter Zijlstra
2007-09-28 20:13 ` Nick Piggin

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=20070924130616.4141a084@twins \
    --to=peterz@infradead.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nickpiggin@yahoo.com.au \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=riel@redhat.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