From: Waiman Long <longman@redhat.com>
To: Vladimir Davydov <vdavydov.dev@gmail.com>
Cc: Roman Gushchin <guro@fb.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
kernel-team@fb.com, Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@kernel.org>, Rik van Riel <riel@surriel.com>,
Shakeel Butt <shakeelb@google.com>,
Christoph Lameter <cl@linux.com>,
cgroups@vger.kernel.org
Subject: Re: [PATCH v5 5/7] mm: rework non-root kmem_cache lifecycle management
Date: Tue, 28 May 2019 13:41:34 -0400 [thread overview]
Message-ID: <518419c5-ee74-d9a1-c01c-f1a3306d2d34@redhat.com> (raw)
In-Reply-To: <20190528173959.h4hq55b3ajlfpjrk@esperanza>
On 5/28/19 1:39 PM, Vladimir Davydov wrote:
> On Tue, May 28, 2019 at 01:37:50PM -0400, Waiman Long wrote:
>> On 5/28/19 1:08 PM, Vladimir Davydov wrote:
>>>> static void flush_memcg_workqueue(struct kmem_cache *s)
>>>> {
>>>> + /*
>>>> + * memcg_params.dying is synchronized using slab_mutex AND
>>>> + * memcg_kmem_wq_lock spinlock, because it's not always
>>>> + * possible to grab slab_mutex.
>>>> + */
>>>> mutex_lock(&slab_mutex);
>>>> + spin_lock(&memcg_kmem_wq_lock);
>>>> s->memcg_params.dying = true;
>>>> + spin_unlock(&memcg_kmem_wq_lock);
>>> I would completely switch from the mutex to the new spin lock -
>>> acquiring them both looks weird.
>>>
>>>> mutex_unlock(&slab_mutex);
>>>>
>>>> /*
>> There are places where the slab_mutex is held and sleeping functions
>> like kvzalloc() are called. I understand that taking both mutex and
>> spinlocks look ugly, but converting all the slab_mutex critical sections
>> to spinlock critical sections will be a major undertaking by itself. So
>> I would suggest leaving that for now.
> I didn't mean that. I meant taking spin_lock wherever we need to access
> the 'dying' flag, even if slab_mutex is held. So that we don't need to
> take mutex_lock in flush_memcg_workqueue, where it's used solely for
> 'dying' synchronization.
OK, that makes sense. Thanks for the clarification.
Cheers,
Longman
next prev parent reply other threads:[~2019-05-28 17:41 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20190521200735.2603003-1-guro@fb.com>
2019-05-22 21:43 ` [PATCH v5 0/7] mm: reparent slab memory on cgroup removal Roman Gushchin
2019-05-22 21:59 ` Andrew Morton
2019-05-22 22:23 ` Roman Gushchin
2019-05-28 7:01 ` Michal Hocko
[not found] ` <20190521200735.2603003-6-guro@fb.com>
2019-05-28 17:08 ` [PATCH v5 5/7] mm: rework non-root kmem_cache lifecycle management Vladimir Davydov
[not found] ` <96b8a923-49e4-f13e-b1e3-3df4598d849e@redhat.com>
2019-05-28 17:39 ` Vladimir Davydov
2019-05-28 17:41 ` Waiman Long [this message]
2019-05-28 18:00 ` Vladimir Davydov
2019-05-28 22:03 ` Johannes Weiner
2019-05-28 22:28 ` Roman Gushchin
[not found] ` <20190521200735.2603003-3-guro@fb.com>
2019-05-28 17:11 ` [PATCH v5 2/7] mm: generalize postponed non-root kmem_cache deactivation Vladimir Davydov
[not found] ` <20190521200735.2603003-5-guro@fb.com>
2019-05-28 17:12 ` [PATCH v5 4/7] mm: unify SLAB and SLUB page accounting Vladimir Davydov
2019-05-28 22:00 ` Johannes Weiner
[not found] ` <20190521200735.2603003-2-guro@fb.com>
2019-05-28 17:14 ` [PATCH v5 1/7] mm: postpone kmem_cache memcg pointer initialization to memcg_link_cache() Vladimir Davydov
2019-05-28 21:56 ` Johannes Weiner
[not found] ` <20190521200735.2603003-8-guro@fb.com>
2019-05-28 17:38 ` [PATCH v5 7/7] mm: fix /proc/kpagecgroup interface for slab pages Vladimir Davydov
[not found] ` <20190521200735.2603003-7-guro@fb.com>
2019-05-28 18:33 ` [PATCH v5 6/7] mm: reparent slab memory on cgroup removal Vladimir Davydov
2019-05-28 19:58 ` Roman Gushchin
2019-05-28 20:11 ` Vladimir Davydov
2019-05-28 21:52 ` Roman Gushchin
2019-05-28 22:16 ` Johannes Weiner
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=518419c5-ee74-d9a1-c01c-f1a3306d2d34@redhat.com \
--to=longman@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=cl@linux.com \
--cc=guro@fb.com \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=riel@surriel.com \
--cc=shakeelb@google.com \
--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;
as well as URLs for NNTP newsgroup(s).