linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Kirill Tkhai <ktkhai@virtuozzo.com>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: mhocko@suse.com, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, vdavydov.dev@gmail.com
Subject: Re: [PATCH RFC 02/10] mm: Make shrink_slab() lockless
Date: Wed, 8 Aug 2018 15:51:11 +0300	[thread overview]
Message-ID: <411e77ce-90a6-8af6-dd57-bd3b6804beff@virtuozzo.com> (raw)
In-Reply-To: <e6489e38-6f73-2f5d-61b6-ffd1f6462aab@i-love.sakura.ne.jp>

On 08.08.2018 15:36, Tetsuo Handa wrote:
> On 2018/08/08 20:51, Kirill Tkhai wrote:
>> @@ -192,7 +193,6 @@ static int prealloc_memcg_shrinker(struct shrinker *shrinker)
>>  	int id, ret = -ENOMEM;
>>  
>>  	down_write(&shrinker_rwsem);
>> -	/* This may call shrinker, so it must use down_read_trylock() */
>>  	id = idr_alloc(&shrinker_idr, SHRINKER_REGISTERING, 0, 0, GFP_KERNEL);
>>  	if (id < 0)
>>  		goto unlock;
> 
> I don't know why perf reports down_read_trylock(&shrinker_rwsem).

This happens in the case of many cgroups and mounts on node. This
is often happen on the big machines with containers.

> But above code is already bad. GFP_KERNEL allocation involves shrinkers and
> the OOM killer would be invoked because shrinkers are defunctional due to
> this down_write(&shrinker_rwsem). Please avoid blocking memory allocation
> with shrinker_rwsem held.

There was non-blocking allocation in first versions of the patchset,
but it's gone away in the process of the review (CC Vladimir).

There are still pages lists shrinkers in case of shrink_slab() is
not available, while additional locks makes the code more difficult
and not worth this difficulties.

Kirill

  reply	other threads:[~2018-08-08 12:51 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-07 15:37 [PATCH RFC 00/10] Introduce lockless shrink_slab() Kirill Tkhai
2018-08-07 15:37 ` [PATCH RFC 01/10] rcu: Make CONFIG_SRCU unconditionally enabled Kirill Tkhai
2018-08-08  0:55   ` Steven Rostedt
2018-08-08  1:05   ` Stephen Rothwell
2018-08-08  9:46     ` Kirill Tkhai
2018-08-08  1:08   ` Stephen Rothwell
2018-08-08  9:59     ` Kirill Tkhai
2018-08-08 11:04       ` Stephen Rothwell
2018-08-08  7:20   ` Michal Hocko
2018-08-08 10:17     ` Kirill Tkhai
2018-08-08 10:27       ` Michal Hocko
2018-08-08 21:31         ` Dave Chinner
2018-08-09  0:07           ` Matthew Wilcox
2018-08-09  7:45             ` Greg KH
2018-08-09 10:22           ` Kirill Tkhai
2018-08-08 16:13       ` Josh Triplett
2018-08-08 16:23         ` Kirill Tkhai
2018-08-08 16:30           ` Kirill Tkhai
2018-08-08 18:01             ` Josh Triplett
2018-08-08 23:02               ` Shakeel Butt
2018-08-08 23:09                 ` Josh Triplett
2018-08-07 15:37 ` [PATCH RFC 02/10] mm: Make shrink_slab() lockless Kirill Tkhai
2018-08-08 11:51   ` Kirill Tkhai
2018-08-08 12:36     ` Tetsuo Handa
2018-08-08 12:51       ` Kirill Tkhai [this message]
2018-08-08 13:20     ` [PATCH RFC v2 " Kirill Tkhai
2018-08-09  7:14       ` Michal Hocko
2018-08-09  9:21         ` Kirill Tkhai
2018-08-09 10:37           ` Tetsuo Handa
2018-08-09 10:58             ` Kirill Tkhai
2018-08-09 11:23         ` Kirill Tkhai
2018-08-07 15:38 ` [PATCH RFC 03/10] mm: Convert shrinker_rwsem to mutex Kirill Tkhai
2018-08-07 15:38 ` [PATCH RFC 04/10] mm: Split unregister_shrinker() Kirill Tkhai
2018-08-07 15:38 ` [PATCH RFC 05/10] fs: Move list_lru_destroy() to destroy_super_work() Kirill Tkhai
2018-08-07 15:38 ` [PATCH RFC 06/10] fs: Shrink only (SB_ACTIVE|SB_BORN) superblocks in super_cache_scan() Kirill Tkhai
2018-08-07 15:38 ` [PATCH RFC 07/10] fs: Introduce struct super_operations::destroy_super() callback Kirill Tkhai
2018-08-07 15:39 ` [PATCH RFC 08/10] xfs: Introduce xfs_fs_destroy_super() Kirill Tkhai
2018-08-07 15:39 ` [PATCH RFC 09/10] shmem: Implement shmem_destroy_super() Kirill Tkhai
2018-08-07 15:39 ` [PATCH RFC 10/10] fs: Use unregister_shrinker_delayed_{initiate, finalize} for super_block shrinker Kirill Tkhai
2018-08-08  1:12 ` [PATCH RFC 00/10] Introduce lockless shrink_slab() Stephen Rothwell
2018-08-08  5:39   ` Shakeel Butt
2018-08-08 10:18     ` Kirill Tkhai

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=411e77ce-90a6-8af6-dd57-bd3b6804beff@virtuozzo.com \
    --to=ktkhai@virtuozzo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=vdavydov.dev@gmail.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