From: Oleg Nesterov <oleg@redhat.com>
To: Alex Thorlton <athorlton@sgi.com>
Cc: linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Rik van Riel <riel@redhat.com>, Mel Gorman <mgorman@suse.de>,
Jiang Liu <liuj97@gmail.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Robin Holt <holt@sgi.com>, Al Viro <viro@zeniv.linux.org.uk>,
Kees Cook <keescook@chromium.org>,
liguang <lig.fnst@cn.fujitsu.com>,
linux-mm@kvack.org
Subject: Re: [PATCH 2/3] Add VM_INIT_DEF_MASK and PRCTL_THP_DISABLE
Date: Mon, 3 Feb 2014 18:46:50 +0100 [thread overview]
Message-ID: <20140203174650.GA27592@redhat.com> (raw)
In-Reply-To: <1391192628-113858-5-git-send-email-athorlton@sgi.com>
On 01/31, Alex Thorlton wrote:
>
> This patch adds a VM_INIT_DEF_MASK,
Perhaps it makes sense to tell a bit more... We add this mask to preserve
VM_NOHUGEPAGE after fork/exec. And this is obviously affects s390, say the
result of KVM_S390_ENABLE_SIE will be preserved.
I hope this is fine, but should be documented and it would be nice to have
the acks from Gerald.
> --- a/kernel/sys.c
> +++ b/kernel/sys.c
> @@ -1996,6 +1996,23 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
> if (arg2 || arg3 || arg4 || arg5)
> return -EINVAL;
> return current->no_new_privs ? 1 : 0;
> + case PR_GET_THP_DISABLE:
> + if (arg2 || arg3 || arg4 || arg5)
> + return -EINVAL;
Cosmetic, but PR_GET_THP_DISABLE only needs to check arg2.
OTOH,
> + case PR_SET_THP_DISABLE:
> + if (arg3 || arg4 || arg5)
> + return -EINVAL;
> + down_write(&me->mm->mmap_sem);
> + if (option == PR_SET_THP_DISABLE) {
> + if (arg2)
> + me->mm->def_flags |= VM_NOHUGEPAGE;
> + else
> + me->mm->def_flags &= ~VM_NOHUGEPAGE;
> + } else {
> + error = !!(me->mm->def_flags & VM_NOHUGEPAGE);
> + }
> + up_write(&me->mm->mmap_sem);
> + break;
Perhaps _GET_ doesn't even need ->mmap_sem, I do not see how the lockless
"&" can get the inconsistent result. But I am fine either way.
Oleg.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Oleg Nesterov <oleg@redhat.com>
To: Alex Thorlton <athorlton@sgi.com>
Cc: linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Rik van Riel <riel@redhat.com>, Mel Gorman <mgorman@suse.de>,
Jiang Liu <liuj97@gmail.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Robin Holt <holt@sgi.com>, Al Viro <viro@zeniv.linux.org.uk>,
Kees Cook <keescook@chromium.org>,
liguang <lig.fnst@cn.fujitsu.com>,
linux-mm@kvack.org
Subject: Re: [PATCH 2/3] Add VM_INIT_DEF_MASK and PRCTL_THP_DISABLE
Date: Mon, 3 Feb 2014 18:46:50 +0100 [thread overview]
Message-ID: <20140203174650.GA27592@redhat.com> (raw)
In-Reply-To: <1391192628-113858-5-git-send-email-athorlton@sgi.com>
On 01/31, Alex Thorlton wrote:
>
> This patch adds a VM_INIT_DEF_MASK,
Perhaps it makes sense to tell a bit more... We add this mask to preserve
VM_NOHUGEPAGE after fork/exec. And this is obviously affects s390, say the
result of KVM_S390_ENABLE_SIE will be preserved.
I hope this is fine, but should be documented and it would be nice to have
the acks from Gerald.
> --- a/kernel/sys.c
> +++ b/kernel/sys.c
> @@ -1996,6 +1996,23 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
> if (arg2 || arg3 || arg4 || arg5)
> return -EINVAL;
> return current->no_new_privs ? 1 : 0;
> + case PR_GET_THP_DISABLE:
> + if (arg2 || arg3 || arg4 || arg5)
> + return -EINVAL;
Cosmetic, but PR_GET_THP_DISABLE only needs to check arg2.
OTOH,
> + case PR_SET_THP_DISABLE:
> + if (arg3 || arg4 || arg5)
> + return -EINVAL;
> + down_write(&me->mm->mmap_sem);
> + if (option == PR_SET_THP_DISABLE) {
> + if (arg2)
> + me->mm->def_flags |= VM_NOHUGEPAGE;
> + else
> + me->mm->def_flags &= ~VM_NOHUGEPAGE;
> + } else {
> + error = !!(me->mm->def_flags & VM_NOHUGEPAGE);
> + }
> + up_write(&me->mm->mmap_sem);
> + break;
Perhaps _GET_ doesn't even need ->mmap_sem, I do not see how the lockless
"&" can get the inconsistent result. But I am fine either way.
Oleg.
next prev parent reply other threads:[~2014-02-03 17:47 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-31 18:23 [PATCHv3 0/3] Add mm flag to control THP Alex Thorlton
2014-01-31 18:23 ` Alex Thorlton
2014-01-31 18:23 ` Alex Thorlton
2014-01-31 18:23 ` Alex Thorlton
2014-01-31 18:23 ` [PATCH 1/3] Revert "thp: make MADV_HUGEPAGE check for mm->def_flags" Alex Thorlton
2014-01-31 18:23 ` Alex Thorlton
2014-01-31 22:52 ` Andrew Morton
2014-01-31 22:52 ` Andrew Morton
2014-02-03 13:53 ` Gerald Schaefer
2014-02-03 13:53 ` Gerald Schaefer
2014-02-03 17:14 ` Alex Thorlton
2014-02-03 17:14 ` Alex Thorlton
2014-01-31 18:23 ` Alex Thorlton
2014-01-31 18:23 ` Alex Thorlton
2014-01-31 18:23 ` [PATCH 2/3] Add VM_INIT_DEF_MASK and PRCTL_THP_DISABLE Alex Thorlton
2014-01-31 18:23 ` Alex Thorlton
2014-01-31 23:00 ` Andrew Morton
2014-01-31 23:00 ` Andrew Morton
2014-02-03 17:22 ` Alex Thorlton
2014-02-03 17:22 ` Alex Thorlton
2014-02-03 17:46 ` Oleg Nesterov [this message]
2014-02-03 17:46 ` Oleg Nesterov
2014-01-31 18:23 ` Alex Thorlton
2014-01-31 18:23 ` Alex Thorlton
2014-01-31 18:23 ` [PATCH 3/3] exec: kill the unnecessary mm->def_flags setting in load_elf_binary() Alex Thorlton
2014-01-31 18:23 ` Alex Thorlton
2014-01-31 18:23 ` Alex Thorlton
2014-01-31 18:23 ` Alex Thorlton
2014-01-31 18:25 ` [PATCHv3 0/3] Add mm flag to control THP Alex Thorlton
2014-01-31 18:25 ` 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=20140203174650.GA27592@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=athorlton@sgi.com \
--cc=ebiederm@xmission.com \
--cc=holt@sgi.com \
--cc=keescook@chromium.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=lig.fnst@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=liuj97@gmail.com \
--cc=mgorman@suse.de \
--cc=mingo@kernel.org \
--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 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.