From: Andrew Morton <akpm@linux-foundation.org>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Zhao Forrest <forrest.zhao@gmail.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: Why kmem_cache_free occupy CPU for more than 10 seconds?
Date: Thu, 12 Apr 2007 00:55:35 -0700 [thread overview]
Message-ID: <20070412005535.951ccb4b.akpm@linux-foundation.org> (raw)
In-Reply-To: <1176363565.6893.73.camel@twins>
On Thu, 12 Apr 2007 09:39:25 +0200 Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:
> On Wed, 2007-04-11 at 15:30 -0700, Andrew Morton wrote:
>
> > There used to be a cond_resched() in invalidate_mapping_pages() which would
> > have prevented this, but I rudely removed it to support
> > /proc/sys/vm/drop_caches (which needs to call invalidate_inode_pages()
> > under spinlock).
> >
> > We could resurrect that cond_resched() by passing in some flag, I guess.
> > Or change the code to poke the softlockup detector. The former would be
> > better.
>
> cond_resched() is conditional on __resched_legal(0)
What's __resched_legal()?
> which should take
> care of being called under a spinlock.
We only increment preempt_count() in spin_lock() if CONFIG_PREEMPT.
> so I guess we can just reinstate the call in invalidate_mapping_pages()
>
> (still waiting on the compile to finish...)
> ---
> invalidate_mapping_pages() is called under locks (usually preemptable)
> but can do a _lot_ of work, stick in a voluntary preemption point to
> avoid excessive latencies (over 10 seconds was reported by softlockup).
>
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> ---
> mm/truncate.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> Index: linux-2.6-mm/mm/truncate.c
> ===================================================================
> --- linux-2.6-mm.orig/mm/truncate.c
> +++ linux-2.6-mm/mm/truncate.c
> @@ -292,6 +292,8 @@ unsigned long invalidate_mapping_pages(s
> pgoff_t index;
> int lock_failed;
>
> + cond_resched();
> +
> lock_failed = TestSetPageLocked(page);
Is deadlocky on the drop_caches path and if CONFIG_PREEMPT we'll get
scheduling-in-spinlock warnings.
For the blkdev_close() path the change is unneeded if CONFIG_PREEMPT and
will fix things if !CONFIG_PREEMPT.
We can presumably just remove the invalidate_mapping_pages() call from the
kill_bdev() path (at least) - kill_bdev()'s truncate_inode_pages() will do
the same thing.
It might be time to remove that unused-for-six-years destroy_dirty_buffers
too.
next prev parent reply other threads:[~2007-04-12 8:20 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-11 6:17 Why kmem_cache_free occupy CPU for more than 10 seconds? Zhao Forrest
2007-04-11 6:53 ` Pekka Enberg
2007-04-11 9:14 ` Zhao Forrest
2007-04-11 9:53 ` Paul Jackson
2007-04-11 10:06 ` Peter Zijlstra
2007-04-11 10:10 ` Zhao Forrest
2007-04-11 10:16 ` Peter Zijlstra
2007-04-11 16:23 ` Chuck Ebbert
2007-04-11 16:44 ` Badari Pulavarty
2007-04-11 9:53 ` Zhao Forrest
2007-04-11 10:38 ` Peter Zijlstra
2007-04-11 16:35 ` Ken Chen
2007-04-12 6:17 ` Zhao Forrest
2007-04-11 22:30 ` Andrew Morton
2007-04-12 7:39 ` Peter Zijlstra
2007-04-12 7:55 ` Andrew Morton [this message]
2007-04-12 9:19 ` Peter Zijlstra
[not found] <fa.jxja7Ze2HZEPZZ5vd0w5eLsKf88@ifi.uio.no>
[not found] ` <fa.RbU8KKG9LmOiypCl0DuBe43HL5c@ifi.uio.no>
[not found] ` <fa.7mgz+w23+bQoEmP17EX7CoXvAKk@ifi.uio.no>
[not found] ` <fa.Iwu0x59X2e1XgdDQWyXObWrcbFY@ifi.uio.no>
[not found] ` <fa.Aj3PE3FoH/kmJ6APQFg2oZN1OFc@ifi.uio.no>
2007-04-13 23:26 ` Robert Hancock
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=20070412005535.951ccb4b.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=a.p.zijlstra@chello.nl \
--cc=forrest.zhao@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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