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


Groups > linux.kernel > #1681032

Re: [patch V2 2/2] mm/memory-hotplug: Switch locking to a percpu rwsem

From Davidlohr Bueso <dave@stgolabs.net>
Newsgroups linux.kernel
Subject Re: [patch V2 2/2] mm/memory-hotplug: Switch locking to a percpu rwsem
Date 2017-07-04 17:10 +0200
Message-ID <tZxCF-1Bv-7@gated-at.bofh.it> (permalink)
References <tZstj-6qV-9@gated-at.bofh.it> <tZstk-6qV-29@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, 04 Jul 2017, Thomas Gleixner wrote:

>Andrey reported a potential deadlock with the memory hotplug lock and the
>cpu hotplug lock.
>
>The reason is that memory hotplug takes the memory hotplug lock and then
>calls stop_machine() which calls get_online_cpus(). That's the reverse lock
>order to get_online_cpus(); get_online_mems(); in mm/slub_common.c
>
>The problem has been there forever. The reason why this was never reported
>is that the cpu hotplug locking had this homebrewn recursive reader writer
>semaphore construct which due to the recursion evaded the full lock dep
>coverage. The memory hotplug code copied that construct verbatim and
>therefor has similar issues.
>
>Three steps to fix this:
>
>1) Convert the memory hotplug locking to a per cpu rwsem so the potential
>   issues get reported proper by lockdep.

I particularly like how the mem hotplug is well suited for pcpu-rwsem.
As a side effect you end up optimizing get/put_online_mems() at the cost
of more overhead for the actual hotplug operation, which is rare and of less
performance importance.

Thanks,
Davidlohr

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