* + thp-extract-khugepaged-from-mm-huge_memoryc-fix.patch added to -mm tree
@ 2016-06-08 21:55 akpm
2016-06-08 22:57 ` Kirill A. Shutemov
0 siblings, 1 reply; 2+ messages in thread
From: akpm @ 2016-06-08 21:55 UTC (permalink / raw)
To: akpm, aarcange, andreslc, aneesh.kumar, cl, dave.hansen, hughd,
jmarchan, kirill.shutemov, n-horiguchi, neha.agbk, peterz, quning,
sasha.levin, vbabka, yang.shi, mm-commits
The patch titled
Subject: thp-extract-khugepaged-from-mm-huge_memoryc-fix
has been added to the -mm tree. Its filename is
thp-extract-khugepaged-from-mm-huge_memoryc-fix.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/thp-extract-khugepaged-from-mm-huge_memoryc-fix.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/thp-extract-khugepaged-from-mm-huge_memoryc-fix.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: Andrew Morton <akpm@linux-foundation.org>
Subject: thp-extract-khugepaged-from-mm-huge_memoryc-fix
khugepaged_mutex can be static to mm/huge_memory.c:enabled_store()
Makes me wonder what it actually does...
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Andres Lagar-Cavilla <andreslc@google.com>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Cc: Christoph Lameter <cl@gentwo.org>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Jerome Marchand <jmarchan@redhat.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Ning Qu <quning@gmail.com>
Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Yang Shi <yang.shi@linaro.org>
Cc: neha agarwal <neha.agbk@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/khugepaged.h | 1 -
mm/huge_memory.c | 1 +
mm/khugepaged.c | 1 -
3 files changed, 1 insertion(+), 2 deletions(-)
diff -puN include/linux/khugepaged.h~thp-extract-khugepaged-from-mm-huge_memoryc-fix include/linux/khugepaged.h
--- a/include/linux/khugepaged.h~thp-extract-khugepaged-from-mm-huge_memoryc-fix
+++ a/include/linux/khugepaged.h
@@ -4,7 +4,6 @@
#include <linux/sched.h> /* MMF_VM_HUGEPAGE */
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
-extern struct mutex khugepaged_mutex;
extern struct attribute_group khugepaged_attr_group;
extern int khugepaged_init(void);
diff -puN mm/huge_memory.c~thp-extract-khugepaged-from-mm-huge_memoryc-fix mm/huge_memory.c
--- a/mm/huge_memory.c~thp-extract-khugepaged-from-mm-huge_memoryc-fix
+++ a/mm/huge_memory.c
@@ -174,6 +174,7 @@ static ssize_t enabled_store(struct kobj
const char *buf, size_t count)
{
ssize_t ret;
+ static DEFINE_MUTEX(khugepaged_mutex);
ret = triple_flag_store(kobj, attr, buf, count,
TRANSPARENT_HUGEPAGE_FLAG,
diff -puN mm/khugepaged.c~thp-extract-khugepaged-from-mm-huge_memoryc-fix mm/khugepaged.c
--- a/mm/khugepaged.c~thp-extract-khugepaged-from-mm-huge_memoryc-fix
+++ a/mm/khugepaged.c
@@ -57,7 +57,6 @@ static unsigned int khugepaged_scan_slee
static unsigned int khugepaged_alloc_sleep_millisecs __read_mostly = 60000;
static unsigned long khugepaged_sleep_expire;
static struct task_struct *khugepaged_thread __read_mostly;
-DEFINE_MUTEX(khugepaged_mutex);
static DEFINE_SPINLOCK(khugepaged_mm_lock);
static DECLARE_WAIT_QUEUE_HEAD(khugepaged_wait);
/*
_
Patches currently in -mm which might be from akpm@linux-foundation.org are
i-need-old-gcc.patch
arch-alpha-kernel-systblss-remove-debug-check.patch
revert-mm-memcontrol-fix-possible-css-ref-leak-on-oom.patch
arm-arch-arm-include-asm-pageh-needs-personalityh.patch
mm.patch
mm-reorganize-slab-freelist-randomization-fix.patch
mm-frontswap-convert-frontswap_enabled-to-static-key-checkpatch-fixes.patch
mm-add-nr_zsmalloc-to-vmstat-fix.patch
mm-memcg-use-consistent-gfp-flags-during-readahead-checkpatch-fixes.patch
mm-thp-avoid-unnecessary-swapin-in-khugepaged-fix.patch
mm-thp-make-swapin-readahead-under-down_read-of-mmap_sem-fix-2-fix.patch
thp-extract-khugepaged-from-mm-huge_memoryc-fix.patch
mm-kasan-switch-slub-to-stackdepot-enable-memory-quarantine-for-slub-fix.patch
mm-kasan-switch-slub-to-stackdepot-enable-memory-quarantine-for-slub-fix-fix.patch
nvme-dont-allocate-unused-nvme_major-fix.patch
bitmap-bitmap_equal-memcmp-optimization-fix.patch
kexec-ensure-user-memory-sizes-do-not-wrap-fix.patch
kexec-allow-architectures-to-override-boot-mapping-fix.patch
drivers-net-wireless-intel-iwlwifi-dvm-calibc-fix-min-warning.patch
kernel-forkc-export-kernel_thread-to-modules.patch
slab-leaks3-default-y.patch
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: + thp-extract-khugepaged-from-mm-huge_memoryc-fix.patch added to -mm tree
2016-06-08 21:55 + thp-extract-khugepaged-from-mm-huge_memoryc-fix.patch added to -mm tree akpm
@ 2016-06-08 22:57 ` Kirill A. Shutemov
0 siblings, 0 replies; 2+ messages in thread
From: Kirill A. Shutemov @ 2016-06-08 22:57 UTC (permalink / raw)
To: linux-kernel
Cc: akpm, aarcange, andreslc, aneesh.kumar, cl, dave.hansen, hughd,
jmarchan, kirill.shutemov, n-horiguchi, neha.agbk, peterz, quning,
sasha.levin, vbabka, yang.shi, mm-commits
On Wed, Jun 08, 2016 at 02:55:01PM -0700, akpm@linux-foundation.org wrote:
>
> The patch titled
> Subject: thp-extract-khugepaged-from-mm-huge_memoryc-fix
> has been added to the -mm tree. Its filename is
> thp-extract-khugepaged-from-mm-huge_memoryc-fix.patch
>
> This patch should soon appear at
> http://ozlabs.org/~akpm/mmots/broken-out/thp-extract-khugepaged-from-mm-huge_memoryc-fix.patch
> and later at
> http://ozlabs.org/~akpm/mmotm/broken-out/thp-extract-khugepaged-from-mm-huge_memoryc-fix.patch
>
> Before you just go and hit "reply", please:
> a) Consider who else should be cc'ed
> b) Prefer to cc a suitable mailing list as well
> c) Ideally: find the original patch on the mailing list and do a
> reply-to-all to that, adding suitable additional cc's
>
> *** Remember to use Documentation/SubmitChecklist when testing your code ***
>
> The -mm tree is included into linux-next and is updated
> there every 3-4 working days
>
> ------------------------------------------------------
> From: Andrew Morton <akpm@linux-foundation.org>
> Subject: thp-extract-khugepaged-from-mm-huge_memoryc-fix
>
> khugepaged_mutex can be static to mm/huge_memory.c:enabled_store()
>
> Makes me wonder what it actually does...
IIUC, it protects khugepaged_thread.
What about something like this:
diff --git a/include/linux/khugepaged.h b/include/linux/khugepaged.h
index f7b4b7dc97bc..1e032a1ddb3e 100644
--- a/include/linux/khugepaged.h
+++ b/include/linux/khugepaged.h
@@ -4,7 +4,6 @@
#include <linux/sched.h> /* MMF_VM_HUGEPAGE */
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
-extern struct mutex khugepaged_mutex;
extern struct attribute_group khugepaged_attr_group;
extern int khugepaged_init(void);
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index eaf3a4a655a6..522cf178f118 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -181,12 +181,7 @@ static ssize_t enabled_store(struct kobject *kobj,
TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG);
if (ret > 0) {
- int err;
-
- mutex_lock(&khugepaged_mutex);
- err = start_stop_khugepaged();
- mutex_unlock(&khugepaged_mutex);
-
+ int err = start_stop_khugepaged();
if (err)
ret = err;
}
diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index 71a6f9bedfdc..6f5815488c6c 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -58,8 +58,6 @@ static unsigned int khugepaged_scan_sleep_millisecs __read_mostly = 10000;
/* during fragmentation poll the hugepage allocator once every minute */
static unsigned int khugepaged_alloc_sleep_millisecs __read_mostly = 60000;
static unsigned long khugepaged_sleep_expire;
-static struct task_struct *khugepaged_thread __read_mostly;
-DEFINE_MUTEX(khugepaged_mutex);
static DEFINE_SPINLOCK(khugepaged_mm_lock);
static DECLARE_WAIT_QUEUE_HEAD(khugepaged_wait);
/*
@@ -1885,7 +1883,11 @@ static void set_recommended_min_free_kbytes(void)
int start_stop_khugepaged(void)
{
+ static struct task_struct *khugepaged_thread __read_mostly;
+ static DEFINE_MUTEX(khugepaged_mutex);
int err = 0;
+
+ mutex_lock(&khugepaged_mutex);
if (khugepaged_enabled()) {
if (!khugepaged_thread)
khugepaged_thread = kthread_run(khugepaged, NULL,
@@ -1906,5 +1908,6 @@ int start_stop_khugepaged(void)
khugepaged_thread = NULL;
}
fail:
+ mutex_unlock(&khugepaged_mutex);
return err;
}
--
Kirill A. Shutemov
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-06-08 22:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-08 21:55 + thp-extract-khugepaged-from-mm-huge_memoryc-fix.patch added to -mm tree akpm
2016-06-08 22:57 ` Kirill A. Shutemov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.