Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1680924

Re: [patch V2 1/2] mm: swap: Provide lru_add_drain_all_cpuslocked()

From Thomas Gleixner <tglx@linutronix.de>
Newsgroups linux.kernel
Subject Re: [patch V2 1/2] mm: swap: Provide lru_add_drain_all_cpuslocked()
Date 2017-07-04 14:50 +0200
Message-ID <tZvrc-8h2-7@gated-at.bofh.it> (permalink)
References <tZstj-6qV-9@gated-at.bofh.it> <tZstj-6qV-11@gated-at.bofh.it> <tZtIL-7a9-35@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, 4 Jul 2017, Michal Hocko wrote:
> On Tue 04-07-17 11:32:33, Thomas Gleixner wrote:
> > The rework of the cpu hotplug locking unearthed potential deadlocks with
> > the memory hotplug locking code.
> > 
> > The solution for these is to rework the memory hotplug locking code as well
> > and take the cpu hotplug lock before the memory hotplug lock in
> > mem_hotplug_begin(), but this will cause a recursive locking of the cpu
> > hotplug lock when the memory hotplug code calls lru_add_drain_all().
> > 
> > Split out the inner workings of lru_add_drain_all() into
> > lru_add_drain_all_cpuslocked() so this function can be invoked from the
> > memory hotplug code with the cpu hotplug lock held.
> 
> You have added callers in the later patch in the series AFAICS which
> is OK but I think it would be better to have them in this patch
> already. Nothing earth shattering (maybe a rebase artifact).

The requirement for changing that comes with the extra hotplug locking in
mem_hotplug_begin(). That is required to establish the proper lock order
and then causes the recursive locking in the next patch. Adding the caller
here would be wrong, because then lru_add_drain_all_cpuslocked() would be
called unprotected. Hens and eggs as usual :)

Thanks,

	tglx

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[patch V2 0/2] mm/memory_hotplug: Cure potential deadlocks vs. cpu  hotplug lock Thomas Gleixner <tglx@linutronix.de> - 2017-07-04 11:40 +0200
  [patch V2 1/2] mm: swap: Provide lru_add_drain_all_cpuslocked() Thomas Gleixner <tglx@linutronix.de> - 2017-07-04 11:40 +0200
    Re: [patch V2 1/2] mm: swap: Provide lru_add_drain_all_cpuslocked() Michal Hocko <mhocko@kernel.org> - 2017-07-04 13:00 +0200
      Re: [patch V2 1/2] mm: swap: Provide  lru_add_drain_all_cpuslocked() Thomas Gleixner <tglx@linutronix.de> - 2017-07-04 14:50 +0200
        Re: [patch V2 1/2] mm: swap: Provide lru_add_drain_all_cpuslocked() Michal Hocko <mhocko@kernel.org> - 2017-07-04 15:00 +0200
    Re: [patch V2 1/2] mm: swap: Provide lru_add_drain_all_cpuslocked() Vlastimil Babka <vbabka@suse.cz> - 2017-07-04 14:10 +0200
      Re: [patch V2 1/2] mm: swap: Provide  lru_add_drain_all_cpuslocked() Thomas Gleixner <tglx@linutronix.de> - 2017-07-04 14:40 +0200
  [patch V2 2/2] mm/memory-hotplug: Switch locking to a percpu rwsem Thomas Gleixner <tglx@linutronix.de> - 2017-07-04 11:40 +0200
    Re: [patch V2 2/2] mm/memory-hotplug: Switch locking to a percpu  rwsem Michal Hocko <mhocko@kernel.org> - 2017-07-04 13:00 +0200
    Re: [patch V2 2/2] mm/memory-hotplug: Switch locking to a percpu  rwsem Vlastimil Babka <vbabka@suse.cz> - 2017-07-04 14:20 +0200
      Re: [patch V2 2/2] mm/memory-hotplug: Switch locking to a percpu  rwsem Thomas Gleixner <tglx@linutronix.de> - 2017-07-04 15:00 +0200
    Re: [patch V2 2/2] mm/memory-hotplug: Switch locking to a percpu  rwsem Davidlohr Bueso <dave@stgolabs.net> - 2017-07-04 17:10 +0200
      Re: [patch V2 2/2] mm/memory-hotplug: Switch locking to a percpu  rwsem Davidlohr Bueso <dave@stgolabs.net> - 2017-07-04 17:30 +0200
        Re: [patch V2 2/2] mm/memory-hotplug: Switch locking to a percpu  rwsem Thomas Gleixner <tglx@linutronix.de> - 2017-07-04 17:40 +0200
          Re: [patch V2 2/2] mm/memory-hotplug: Switch locking to a percpu  rwsem Davidlohr Bueso <dave@stgolabs.net> - 2017-07-04 17:50 +0200
  Re: [patch V2 0/2] mm/memory_hotplug: Cure potential deadlocks vs.  cpu hotplug lock Andrew Morton <akpm@linux-foundation.org> - 2017-07-06 00:00 +0200
    Re: [patch V2 0/2] mm/memory_hotplug: Cure potential deadlocks vs.  cpu hotplug lock Thomas Gleixner <tglx@linutronix.de> - 2017-07-06 08:40 +0200

csiph-web