• Nicolai Stange's avatar
    mm, meminit: replace rwsem with completion · d3cd131d
    Nicolai Stange authored
    Commit 0e1cc95b ("mm: meminit: finish initialisation of struct pages
    before basic setup") introduced a rwsem to signal completion of the
    initialization workers.
    
    Lockdep complains about possible recursive locking:
      =============================================
      [ INFO: possible recursive locking detected ]
      4.1.0-12802-g1dc51b82 #3 Not tainted
      ---------------------------------------------
      swapper/0/1 is trying to acquire lock:
      (pgdat_init_rwsem){++++.+},
        at: [<ffffffff8424c7fb>] page_alloc_init_late+0xc7/0xe6
    
      but task is already holding lock:
      (pgdat_init_rwsem){++++.+},
        at: [<ffffffff8424c772>] page_alloc_init_late+0x3e/0xe6
    
    Replace the rwsem by a completion together with an atomic
    "outstanding work counter".
    
    [peterz@infradead.org: Barrier removal on the grounds of being pointless]
    [mgorman@suse.de: Applied review feedback]
    Signed-off-by: default avatarNicolai Stange <nicstange@gmail.com>
    Signed-off-by: default avatarMel Gorman <mgorman@suse.de>
    Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Dave Hansen <dave.hansen@intel.com>
    Cc: Alex Ng <alexng@microsoft.com>
    Cc: Fengguang Wu <fengguang.wu@intel.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    d3cd131d
page_alloc.c 193 KB