All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Michal Hocko <mhocko@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Tejun Heo <tj@kernel.org>, Peter Zijlstra <peterz@infradead.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Mel Gorman <mgorman@suse.de>,
	linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>,
	Michal Hocko <mhocko@suse.com>
Subject: Re: [PATCH] mm: drop hotplug lock from lru_add_drain_all
Date: Tue, 14 Nov 2017 15:13:27 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.20.1711141512180.2044@nanos> (raw)
In-Reply-To: <20171114135348.28704-1-mhocko@kernel.org>

On Tue, 14 Nov 2017, Michal Hocko wrote:
> From: Michal Hocko <mhocko@suse.com>
> 
> Pulling cpu hotplug locks inside the mm core function like
> lru_add_drain_all just asks for problems and the recent lockdep splat
> [1] just proves this. While the usage in that particular case might
> be wrong we should prevent from locking as lru_add_drain_all is used
> at many places. It seems that this is not all that hard to achieve
> actually.
> 
> We have done the same thing for drain_all_pages which is analogous by
> a459eeb7b852 ("mm, page_alloc: do not depend on cpu hotplug locks inside
> the allocator"). All we have to care about is to handle
>       - the work item might be executed on a different cpu in worker from
>         unbound pool so it doesn't run on pinned on the cpu
> 
>       - we have to make sure that we do not race with page_alloc_cpu_dead
>         calling lru_add_drain_cpu
> 
> the first part is already handled because the worker calls lru_add_drain
> which disables preemption when calling lru_add_drain_cpu on the local
> cpu it is draining. The later is true because page_alloc_cpu_dead
> is called on the controlling CPU after the hotplugged CPU vanished
> completely.
> 
> [1] http://lkml.kernel.org/r/089e0825eec8955c1f055c83d476@google.com
> 
> Signed-off-by: Michal Hocko <mhocko@suse.com>
> ---
> Hi,
> this has been posted as 2 patch series [1] previously. It turned out
> that the first patch was simply broken and the second one could be
> simplified because the irq disabling is just pointless. There were
> no other objections so I am resending this patch which should remove
> quite a large space of potential lockups as lru_add_drain_all is used
> at many places so removing the hoptlug locking is a good thing in
> general.
> 
> Can we have this merged or there are still some objections?

No objections. The explanation makes sense, but it might be worth to have a
comment at lru_add_drain_all() which explains the protection rules.

Thanks,

	tglx

WARNING: multiple messages have this Message-ID
From: Thomas Gleixner <tglx@linutronix.de>
To: Michal Hocko <mhocko@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Tejun Heo <tj@kernel.org>, Peter Zijlstra <peterz@infradead.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Mel Gorman <mgorman@suse.de>,
	linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>,
	Michal Hocko <mhocko@suse.com>
Subject: Re: [PATCH] mm: drop hotplug lock from lru_add_drain_all
Date: Tue, 14 Nov 2017 15:13:27 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.20.1711141512180.2044@nanos> (raw)
In-Reply-To: <20171114135348.28704-1-mhocko@kernel.org>

On Tue, 14 Nov 2017, Michal Hocko wrote:
> From: Michal Hocko <mhocko@suse.com>
> 
> Pulling cpu hotplug locks inside the mm core function like
> lru_add_drain_all just asks for problems and the recent lockdep splat
> [1] just proves this. While the usage in that particular case might
> be wrong we should prevent from locking as lru_add_drain_all is used
> at many places. It seems that this is not all that hard to achieve
> actually.
> 
> We have done the same thing for drain_all_pages which is analogous by
> a459eeb7b852 ("mm, page_alloc: do not depend on cpu hotplug locks inside
> the allocator"). All we have to care about is to handle
>       - the work item might be executed on a different cpu in worker from
>         unbound pool so it doesn't run on pinned on the cpu
> 
>       - we have to make sure that we do not race with page_alloc_cpu_dead
>         calling lru_add_drain_cpu
> 
> the first part is already handled because the worker calls lru_add_drain
> which disables preemption when calling lru_add_drain_cpu on the local
> cpu it is draining. The later is true because page_alloc_cpu_dead
> is called on the controlling CPU after the hotplugged CPU vanished
> completely.
> 
> [1] http://lkml.kernel.org/r/089e0825eec8955c1f055c83d476@google.com
> 
> Signed-off-by: Michal Hocko <mhocko@suse.com>
> ---
> Hi,
> this has been posted as 2 patch series [1] previously. It turned out
> that the first patch was simply broken and the second one could be
> simplified because the irq disabling is just pointless. There were
> no other objections so I am resending this patch which should remove
> quite a large space of potential lockups as lru_add_drain_all is used
> at many places so removing the hoptlug locking is a good thing in
> general.
> 
> Can we have this merged or there are still some objections?

No objections. The explanation makes sense, but it might be worth to have a
comment at lru_add_drain_all() which explains the protection rules.

Thanks,

	tglx

--
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:[~2017-11-14 14:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-14 13:53 Michal Hocko
2017-11-14 13:53 ` Michal Hocko
2017-11-14 14:13 ` Thomas Gleixner [this message]
2017-11-14 14:13   ` Thomas Gleixner
2017-11-14 14:23   ` Michal Hocko
2017-11-14 14:23     ` Michal Hocko
2017-11-14 14:32     ` Michal Hocko
2017-11-14 14:32       ` Michal Hocko
2017-11-14 15:05       ` Thomas Gleixner
2017-11-14 15:05         ` Thomas Gleixner
2017-11-14 15:11         ` Thomas Gleixner
2017-11-14 15:11           ` Thomas Gleixner
2017-11-14 15:14         ` Michal Hocko
2017-11-14 15:14           ` Michal Hocko
2017-11-16 12:05 Michal Hocko
2017-11-16 12:05 ` Michal Hocko

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=alpine.DEB.2.20.1711141512180.2044@nanos \
    --to=tglx@linutronix.de \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=mhocko@kernel.org \
    --cc=mhocko@suse.com \
    --cc=peterz@infradead.org \
    --cc=tj@kernel.org \
    --subject='Re: [PATCH] mm: drop hotplug lock from lru_add_drain_all' \
    /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

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.