All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] fs: avoid locking sb_lock in grab_super_passive()
Date: Sat, 21 Feb 2015 02:37:55 +0000	[thread overview]
Message-ID: <20150221023754.GT29656@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20150219171934.20458.30175.stgit@buzz>

On Thu, Feb 19, 2015 at 08:19:35PM +0300, Konstantin Khlebnikov wrote:
> I've noticed significant locking contention in memory reclaimer around
> sb_lock inside grab_super_passive(). Grab_super_passive() is called from
> two places: in icache/dcache shrinkers (function super_cache_scan) and
> from writeback (function __writeback_inodes_wb). Both are required for
> progress in memory reclaimer.
> 
> Also this lock isn't irq-safe. And I've seen suspicious livelock under
> serious memory pressure where reclaimer was called from interrupt which
> have happened right in place where sb_lock is held in normal context,
> so all other cpus were stuck on that lock too.

Excuse me, but this part is BS - its call is immediately preceded by
        if (!(sc->gfp_mask & __GFP_FS))
                return SHRINK_STOP;
and if we *ever* hit GFP_FS allocation from interrupt, we are really
screwed.  If nothing else, both prune_dcache_sb() and prune_icache_sb()
can wait for all kinds of IO; you really don't want that called in an
interrupt context.  The same goes for writeback_sb_inodes(), while we
are at it.

If you ever see that in an interrupt context, you have a very bad problem
on hands.

Said that, not bothering with sb_lock (and ->s_count) in those two callers
makes sense.  Applied, with name changed to trylock_super().

--
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>

WARNING: multiple messages have this Message-ID (diff)
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] fs: avoid locking sb_lock in grab_super_passive()
Date: Sat, 21 Feb 2015 02:37:55 +0000	[thread overview]
Message-ID: <20150221023754.GT29656@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20150219171934.20458.30175.stgit@buzz>

On Thu, Feb 19, 2015 at 08:19:35PM +0300, Konstantin Khlebnikov wrote:
> I've noticed significant locking contention in memory reclaimer around
> sb_lock inside grab_super_passive(). Grab_super_passive() is called from
> two places: in icache/dcache shrinkers (function super_cache_scan) and
> from writeback (function __writeback_inodes_wb). Both are required for
> progress in memory reclaimer.
> 
> Also this lock isn't irq-safe. And I've seen suspicious livelock under
> serious memory pressure where reclaimer was called from interrupt which
> have happened right in place where sb_lock is held in normal context,
> so all other cpus were stuck on that lock too.

Excuse me, but this part is BS - its call is immediately preceded by
        if (!(sc->gfp_mask & __GFP_FS))
                return SHRINK_STOP;
and if we *ever* hit GFP_FS allocation from interrupt, we are really
screwed.  If nothing else, both prune_dcache_sb() and prune_icache_sb()
can wait for all kinds of IO; you really don't want that called in an
interrupt context.  The same goes for writeback_sb_inodes(), while we
are at it.

If you ever see that in an interrupt context, you have a very bad problem
on hands.

Said that, not bothering with sb_lock (and ->s_count) in those two callers
makes sense.  Applied, with name changed to trylock_super().

  parent reply	other threads:[~2015-02-21  2:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-19 17:19 [PATCH] fs: avoid locking sb_lock in grab_super_passive() Konstantin Khlebnikov
2015-02-19 17:19 ` Konstantin Khlebnikov
2015-02-19 21:06 ` Konstantin Khlebnikov
2015-02-19 21:06   ` Konstantin Khlebnikov
2015-02-20 23:07 ` Andrew Morton
2015-02-20 23:07   ` Andrew Morton
2015-02-20 23:50   ` Al Viro
2015-02-20 23:50     ` Al Viro
2015-02-24 10:41     ` Konstantin Khlebnikov
2015-02-24 10:41       ` Konstantin Khlebnikov
2015-02-21  2:37 ` Al Viro [this message]
2015-02-21  2:37   ` Al Viro
2015-02-24  9:19   ` Konstantin Khlebnikov
2015-02-24  9:19     ` Konstantin Khlebnikov

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=20150221023754.GT29656@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=khlebnikov@yandex-team.ru \
    --cc=linux-fsdevel@vger.kernel.org \
    --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 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.