From: Oleg Nesterov <oleg@redhat.com>
To: Alex Thorlton <athorlton@sgi.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: "Kirill A. Shutemov" <kirill@shutemov.name>,
linux-kernel@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Rik van Riel <riel@redhat.com>,
Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Andy Lutomirski <luto@amacapital.net>,
Al Viro <viro@zeniv.linux.org.uk>,
Kees Cook <keescook@chromium.org>,
Andrea Arcangeli <aarcange@redhat.com>
Subject: Re: [PATCH 0/2] mm->def_flags cleanups (Was: Change khugepaged to respect MMF_THP_DISABLE flag)
Date: Wed, 22 Jan 2014 19:11:24 +0100 [thread overview]
Message-ID: <20140122181124.GA31090@redhat.com> (raw)
In-Reply-To: <20140122174553.GA29710@redhat.com>
On 01/22, Oleg Nesterov wrote:
>
> Can't we simply add VM_NOHUGEPAGE into ->def_flags? See the (untested)
> patch below, on top of this series.
And perhaps the patch below makes sense as a separate change, I dunno.
------------------------------------------------------------------------------
Subject: [PATCH] mm: introduce VM_INIT_DEF_MASK
mm_init() always sets new_mm->def_flags = 0. We might want to
inherit some bits like we do with mm->flags.
Add the new VM_INIT_DEF_MASK (currently zero) which acts like
MMF_INIT_MASK for ->def_flags.
---
include/linux/mm.h | 2 ++
kernel/fork.c | 11 ++++++++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 1cedd00..0a340c9 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -167,6 +167,8 @@ extern unsigned int kobjsize(const void *objp);
*/
#define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_PFNMAP)
+#define VM_INIT_DEF_MASK 0
+
/*
* mapping from the currently active vm_flags protection bits (the
* low four bits) to a page protection mask..
diff --git a/kernel/fork.c b/kernel/fork.c
index b84bef7..f6d020b 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -529,8 +529,6 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p)
atomic_set(&mm->mm_count, 1);
init_rwsem(&mm->mmap_sem);
INIT_LIST_HEAD(&mm->mmlist);
- mm->flags = (current->mm) ?
- (current->mm->flags & MMF_INIT_MASK) : default_dump_filter;
mm->core_state = NULL;
atomic_long_set(&mm->nr_ptes, 0);
memset(&mm->rss_stat, 0, sizeof(mm->rss_stat));
@@ -538,8 +536,15 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p)
mm_init_aio(mm);
mm_init_owner(mm, p);
- if (likely(!mm_alloc_pgd(mm))) {
+ if (current->mm) {
+ mm->flags = current->mm->flags & MMF_INIT_MASK;
+ mm->def_flags = current->mm->def_flags & VM_INIT_DEF_MASK;
+ } else {
+ mm->flags = default_dump_filter;
mm->def_flags = 0;
+ }
+
+ if (likely(!mm_alloc_pgd(mm))) {
mmu_notifier_mm_init(mm);
return mm;
}
--
1.5.5.1
next prev parent reply other threads:[~2014-01-22 18:11 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-16 21:01 [RFC PATCHv2 1/2] Add mm flag to control THP Alex Thorlton
2014-01-16 21:01 ` [RFC PATCHv2 2/2] Change khugepaged to respect MMF_THP_DISABLE flag Alex Thorlton
2014-01-17 20:34 ` Oleg Nesterov
2014-01-17 22:58 ` Alex Thorlton
2014-01-18 23:49 ` Kirill A. Shutemov
2014-01-20 19:58 ` Alex Thorlton
2014-01-20 20:15 ` Oleg Nesterov
2014-01-20 20:41 ` Alex Thorlton
2014-01-22 17:45 ` [PATCH 0/2] mm->def_flags cleanups (Was: Change khugepaged to respect MMF_THP_DISABLE flag) Oleg Nesterov
2014-01-22 17:46 ` [PATCH 1/2] exec: kill the unnecessary mm->def_flags setting in load_elf_binary() Oleg Nesterov
2014-01-22 17:46 ` [PATCH 2/2] mm: thp: kill the bogus ->def_flags check in hugepage_madvise() Oleg Nesterov
2014-01-22 20:16 ` Hugh Dickins
2014-01-23 16:43 ` Oleg Nesterov
2014-01-24 14:19 ` Gerald Schaefer
2014-01-22 18:11 ` Oleg Nesterov [this message]
2014-01-22 18:40 ` [PATCH 0/2] mm->def_flags cleanups (Was: Change khugepaged to respect MMF_THP_DISABLE flag) Alex Thorlton
2014-01-22 19:25 ` Oleg Nesterov
2014-01-22 19:43 ` Oleg Nesterov
2014-01-22 20:02 ` Alex Thorlton
2014-01-23 16:47 ` Oleg Nesterov
2014-01-17 19:54 ` [RFC PATCHv2 1/2] Add mm flag to control THP Andy Lutomirski
2014-01-17 22:54 ` Alex Thorlton
2014-01-17 20:09 ` Oleg Nesterov
2014-01-17 22:52 ` Alex Thorlton
2014-01-18 23:41 ` Kirill A. Shutemov
2014-01-20 17:26 ` Alex Thorlton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140122181124.GA31090@redhat.com \
--to=oleg@redhat.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=athorlton@sgi.com \
--cc=benh@kernel.crashing.org \
--cc=ebiederm@xmission.com \
--cc=keescook@chromium.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=kirill@shutemov.name \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mingo@redhat.com \
--cc=n-horiguchi@ah.jp.nec.com \
--cc=peterz@infradead.org \
--cc=riel@redhat.com \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).