]> git.karo-electronics.de Git - karo-tx-linux.git/commit
thp: move khugepaged_mutex out of khugepaged
authorXiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Wed, 26 Sep 2012 01:33:21 +0000 (11:33 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 27 Sep 2012 07:25:54 +0000 (17:25 +1000)
commite3d1ead83b1809050e824e5f1dfe97030f685bd2
tree3fd9789a17982fb403853bdd934b0b4195f028c5
parent56819eed81de1538639994c70afdcd92435417c8
thp: move khugepaged_mutex out of khugepaged

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: Xiao 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: Andrew Morton <akpm@linux-foundation.org>
mm/huge_memory.c