All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Nikanth Karthikesan <knikanth@suse.de>
Cc: Jan Kara <jack@suse.cz>, WU Fengguang <wfg@mail.ustc.edu.cn>,
	npiggin@suse.de, Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-mm@kvack.org, hch@infradead.org, chris.mason@oracle.com
Subject: Re: [RFC] [PATCH] Avoid livelock for fsync
Date: Tue, 27 Oct 2009 16:32:51 +0100	[thread overview]
Message-ID: <20091027153251.GA5345@duck.suse.cz> (raw)
In-Reply-To: <200910271926.15176.knikanth@suse.de>

On Tue 27-10-09 19:26:14, Nikanth Karthikesan wrote:
> On Monday 26 October 2009 23:43:14 Jan Kara wrote:
> >   Hi,
> > 
> >   on my way back from Kernel Summit, I've coded the attached patch which
> > implements livelock avoidance for write_cache_pages. We tag patches that
> > should be written in the beginning of write_cache_pages and then write
> > only tagged pages (see the patch for details). The patch is based on Nick's
> > idea.
> 
> As I understand, livelock can be caused only by dirtying new pages.
> 
> So theoretically, if a process can dirty pages faster than we can tag pages 
> for writeback, even now isn't there a chance for livelock? But if it is really 
  Yes, theoretically the livelock is still there but practically, I don't
think it's triggerable (the amount of work needed to do either write(2) or
page fault is much higher than just looking up a page in radix tree and
setting there one bit). If the file has lots of dirty pages, I belive user
can create a few more while we are tagging but not much...

> a very fast operation and livelock is not possible, why not hold the tree_lock 
> during the entire period of tagging the pages for writeback i.e., call 
> tag_pages_for_writeback() under mapping->tree_lock? Would it cause 
> deadlock/starvation or some other serious problems?
  I'm dropping tree_lock because I don't think I can hold it during
pagevec_lookup_tag. Even if that was worked-around, if the file has lots of
dirty pages, it could take us long enough to tag all of them that it would
matter latency-wise for other users of the lock. So I'd leave the code as
is.

									Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

WARNING: multiple messages have this Message-ID (diff)
From: Jan Kara <jack@suse.cz>
To: Nikanth Karthikesan <knikanth@suse.de>
Cc: Jan Kara <jack@suse.cz>, WU Fengguang <wfg@mail.ustc.edu.cn>,
	npiggin@suse.de, Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-mm@kvack.org, hch@infradead.org, chris.mason@oracle.com
Subject: Re: [RFC] [PATCH] Avoid livelock for fsync
Date: Tue, 27 Oct 2009 16:32:51 +0100	[thread overview]
Message-ID: <20091027153251.GA5345@duck.suse.cz> (raw)
In-Reply-To: <200910271926.15176.knikanth@suse.de>

On Tue 27-10-09 19:26:14, Nikanth Karthikesan wrote:
> On Monday 26 October 2009 23:43:14 Jan Kara wrote:
> >   Hi,
> > 
> >   on my way back from Kernel Summit, I've coded the attached patch which
> > implements livelock avoidance for write_cache_pages. We tag patches that
> > should be written in the beginning of write_cache_pages and then write
> > only tagged pages (see the patch for details). The patch is based on Nick's
> > idea.
> 
> As I understand, livelock can be caused only by dirtying new pages.
> 
> So theoretically, if a process can dirty pages faster than we can tag pages 
> for writeback, even now isn't there a chance for livelock? But if it is really 
  Yes, theoretically the livelock is still there but practically, I don't
think it's triggerable (the amount of work needed to do either write(2) or
page fault is much higher than just looking up a page in radix tree and
setting there one bit). If the file has lots of dirty pages, I belive user
can create a few more while we are tagging but not much...

> a very fast operation and livelock is not possible, why not hold the tree_lock 
> during the entire period of tagging the pages for writeback i.e., call 
> tag_pages_for_writeback() under mapping->tree_lock? Would it cause 
> deadlock/starvation or some other serious problems?
  I'm dropping tree_lock because I don't think I can hold it during
pagevec_lookup_tag. Even if that was worked-around, if the file has lots of
dirty pages, it could take us long enough to tag all of them that it would
matter latency-wise for other users of the lock. So I'd leave the code as
is.

									Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2009-10-27 15:32 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-26 18:13 [RFC] [PATCH] Avoid livelock for fsync Jan Kara
2009-10-26 18:13 ` Jan Kara
2009-10-27  3:39 ` Nick Piggin
2009-10-27  3:39   ` Nick Piggin
2009-10-27  9:17   ` Jan Kara
2009-10-27  9:17     ` Jan Kara
2009-10-27 13:56 ` Nikanth Karthikesan
2009-10-27 13:56   ` Nikanth Karthikesan
2009-10-27 15:32   ` Jan Kara [this message]
2009-10-27 15:32     ` Jan Kara
2009-10-28 21:47 ` Andrew Morton
2009-10-28 21:47   ` Andrew Morton
2009-11-02  3:34   ` Nick Piggin
2009-11-02  3:34     ` Nick Piggin
2009-11-03 13:14 ` Wu Fengguang
2009-11-03 13:14   ` Wu Fengguang
2009-11-03 14:56   ` Jan Kara
2009-11-03 14:56     ` Jan Kara
2009-11-04 11:32     ` Wu Fengguang
2009-11-04 11:32       ` Wu Fengguang

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=20091027153251.GA5345@duck.suse.cz \
    --to=jack@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=chris.mason@oracle.com \
    --cc=hch@infradead.org \
    --cc=knikanth@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=npiggin@suse.de \
    --cc=wfg@mail.ustc.edu.cn \
    /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.