[lkml]   [2017]   [Nov]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] mm: drop hotplug lock from lru_add_drain_all
On Tue, 14 Nov 2017, Michal Hocko wrote:
> From: Michal Hocko <>
> 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]
> Signed-off-by: Michal Hocko <>
> ---
> 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.



 \ /
  Last update: 2017-11-14 15:13    [W:0.050 / U:2.852 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site