• X
    thp: move khugepaged_mutex out of khugepaged · 911891af
    Xiao Guangrong 提交于
    Currently, hugepaged_mutex is used really complexly and hard to
    understand, actually, it is just used to serialize start_khugepaged and
    khugepaged for these reasons:
    
    - khugepaged_thread is shared between them
    - the thp disable path (echo never > transparent_hugepage/enabled) is
      nonblocking, so we need to protect khugepaged_thread to get a stable
      running state
    
    These can be avoided by:
    
    - use the lock to serialize the thread creation and cancel
    - thp disable path can not finised until the thread exits
    
    Then khugepaged_thread is fully controlled by start_khugepaged, khugepaged
    will be happy without the lock
    Signed-off-by: NXiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
    Cc: Andrea Arcangeli <aarcange@redhat.com>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: David Rientjes <rientjes@google.com>
    Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
    911891af
huge_memory.c 62.9 KB