From: David Hildenbrand <david@redhat.com>
To: Zach O'Keefe <zokeefe@google.com>, linux-mm@kvack.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
Hugh Dickins <hughd@google.com>, Yang Shi <shy828301@gmail.com>
Subject: Re: [PATCH] mm/shmem: restore SHMEM_HUGE_DENY precedence over MADV_COLLAPSE
Date: Mon, 2 Jan 2023 14:24:49 +0100 [thread overview]
Message-ID: <82e1b316-5b83-bbc9-ccc2-f416bd8e35c6@redhat.com> (raw)
In-Reply-To: <20221223003833.2793963-1-zokeefe@google.com>
On 23.12.22 01:38, Zach O'Keefe wrote:
> SHMEM_HUGE_DENY is for emergency use by the admin, to disable allocation
> of shmem huge pages if, for example, a dangerous bug is found in their
> usage: see "deny" in Documentation/mm/transhuge.rst. An app using
> madvise(,,MADV_COLLAPSE) should not be allowed to override it: restore
> its precedence over shmem_huge_force.
>
> Fixes: 7c6c6cc4d3a2 ("mm/shmem: add flag to enforce shmem THP in hugepage_vma_check()")
> Suggested-by: Hugh Dickins <hughd@google.com>
> Signed-off-by: Zach O'Keefe <zokeefe@google.com>
> Cc: Yang Shi <shy828301@gmail.com>
> ---
> mm/shmem.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/mm/shmem.c b/mm/shmem.c
> index c301487be5fb..0005ab2c29af 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -478,12 +478,10 @@ bool shmem_is_huge(struct vm_area_struct *vma, struct inode *inode,
> if (vma && ((vma->vm_flags & VM_NOHUGEPAGE) ||
> test_bit(MMF_DISABLE_THP, &vma->vm_mm->flags)))
> return false;
> - if (shmem_huge_force)
> - return true;
> - if (shmem_huge == SHMEM_HUGE_FORCE)
> - return true;
> if (shmem_huge == SHMEM_HUGE_DENY)
> return false;
> + if (shmem_huge_force || shmem_huge == SHMEM_HUGE_FORCE)
> + return true;
>
> switch (SHMEM_SB(inode->i_sb)->huge) {
> case SHMEM_HUGE_ALWAYS:
Looks sane to me
Acked-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
prev parent reply other threads:[~2023-01-02 13:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-23 0:38 Zach O'Keefe
2023-01-02 13:24 ` David Hildenbrand [this message]
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=82e1b316-5b83-bbc9-ccc2-f416bd8e35c6@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=linux-mm@kvack.org \
--cc=shy828301@gmail.com \
--cc=zokeefe@google.com \
/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