public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Mike Pagano" <mpagano@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/linux-patches:6.7 commit in: /
Date: Fri, 26 Jan 2024 22:44:15 +0000 (UTC)	[thread overview]
Message-ID: <1706309040.7ebd3d5eb40bc16b8efe35e288abc36fb859c16c.mpagano@gentoo> (raw)

commit:     7ebd3d5eb40bc16b8efe35e288abc36fb859c16c
Author:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 26 22:44:00 2024 +0000
Commit:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Fri Jan 26 22:44:00 2024 +0000
URL:        https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=7ebd3d5e

mm: huge_memory: don't force huge page alignment on 32 bit

Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>

 0000_README                                  |  4 ++
 1800_mm-32-bit-huge-page-alignment-fix.patch | 57 ++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+)

diff --git a/0000_README b/0000_README
index 34a20863..19339793 100644
--- a/0000_README
+++ b/0000_README
@@ -63,6 +63,10 @@ Patch:  1730_parisc-Disable-prctl.patch
 From:	  https://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux.git
 Desc:	  prctl: Temporarily disable prctl(PR_SET_MDWE) on parisc
 
+Patch:  1800_mm-32-bit-huge-page-alignment-fix.patch
+From:   https://lore.kernel.org/all/20240118180505.2914778-1-shy828301@gmail.com/T/
+Desc:   mm: huge_memory: don't force huge page alignment on 32 bit
+
 Patch:  1805_mm-disable-CONFIG-PER-VMA-LOCK-by-def.patch
 From:   https://lore.kernel.org/all/20230703182150.2193578-1-surenb@google.com/
 Desc:   mm: disable CONFIG_PER_VMA_LOCK by default until its fixed

diff --git a/1800_mm-32-bit-huge-page-alignment-fix.patch b/1800_mm-32-bit-huge-page-alignment-fix.patch
new file mode 100644
index 00000000..5ad5d49b
--- /dev/null
+++ b/1800_mm-32-bit-huge-page-alignment-fix.patch
@@ -0,0 +1,57 @@
+From: Yang Shi @ 2024-01-18 13:35 UTC (permalink / raw)
+  To: jirislaby, surenb, riel, willy, cl, akpm; +Cc: yang, linux-mm, linux-kernel
+
+From: Yang Shi <yang@os.amperecomputing.com>
+
+The commit efa7df3e3bb5 ("mm: align larger anonymous mappings on THP
+boundaries") caused two issues [1] [2] reported on 32 bit system or compat
+userspace.
+
+It doesn't make too much sense to force huge page alignment on 32 bit
+system due to the constrained virtual address space.
+
+[1] https://lore.kernel.org/linux-mm/CAHbLzkqa1SCBA10yjWTtA2mKCsoK5+M1BthSDL8ROvUq2XxZMw@mail.gmail.com/T/#mf211643a0427f8d6495b5b53f8132f453d60ab95
+[2] https://lore.kernel.org/linux-mm/CAHbLzkqa1SCBA10yjWTtA2mKCsoK5+M1BthSDL8ROvUq2XxZMw@mail.gmail.com/T/#me93dff2ccbd9902c3e395e1c022fb454e48ecb1d
+
+Fixes: efa7df3e3bb5 ("mm: align larger anonymous mappings on THP boundaries")
+Reported-by: Jiri Slaby <jirislaby@kernel.org>
+Reported-by: Suren Baghdasaryan <surenb@google.com>
+Tested-by: Jiri Slaby <jirislaby@kernel.org>
+Tested-by: Suren Baghdasaryan <surenb@google.com>
+Cc: Rik van Riel <riel@surriel.com>
+Cc: Matthew Wilcox <willy@infradead.org>
+Cc: Christopher Lameter <cl@linux.com>
+Signed-off-by: Yang Shi <yang@os.amperecomputing.com>
+---
+ mm/huge_memory.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/mm/huge_memory.c b/mm/huge_memory.c
+index 94ef5c02b459..e9fbaccbe0c0 100644
+--- a/mm/huge_memory.c
++++ b/mm/huge_memory.c
+@@ -37,6 +37,7 @@
+ #include <linux/page_owner.h>
+ #include <linux/sched/sysctl.h>
+ #include <linux/memory-tiers.h>
++#include <linux/compat.h>
+ 
+ #include <asm/tlb.h>
+ #include <asm/pgalloc.h>
+@@ -811,6 +812,14 @@ static unsigned long __thp_get_unmapped_area(struct file *filp,
+ 	loff_t off_align = round_up(off, size);
+ 	unsigned long len_pad, ret;
+ 
++	/*
++	 * It doesn't make too much sense to froce huge page alignment on
++	 * 32 bit system or compat userspace due to the contrained virtual
++	 * address space and address entropy.
++	 */
++	if (IS_ENABLED(CONFIG_32BIT) || in_compat_syscall())
++		return 0;
++
+ 	if (off_end <= off_align || (off_end - off_align) < size)
+ 		return 0;
+ 
+-- 
+2.41.0


             reply	other threads:[~2024-01-26 22:44 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-26 22:44 Mike Pagano [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-04-03 13:53 [gentoo-commits] proj/linux-patches:6.7 commit in: / Mike Pagano
2024-03-27 11:23 Mike Pagano
2024-03-15 21:59 Mike Pagano
2024-03-06 18:06 Mike Pagano
2024-03-02 22:36 Mike Pagano
2024-03-01 13:06 Mike Pagano
2024-02-24 19:39 Mike Pagano
2024-02-23 14:19 Mike Pagano
2024-02-23 13:28 Mike Pagano
2024-02-23 12:33 Mike Pagano
2024-02-16 18:55 Mike Pagano
2024-02-05 21:13 Mike Pagano
2024-02-05 20:59 Mike Pagano
2024-02-02 17:52 Mike Pagano
2024-02-01  1:22 Mike Pagano
2024-01-30 19:22 Mike Pagano
2024-01-30 19:20 Mike Pagano
2024-01-26 22:44 Mike Pagano
2024-01-26  0:20 Mike Pagano
2024-01-26  0:17 Mike Pagano
2024-01-25 13:26 Mike Pagano
2024-01-21 15:14 Mike Pagano
2024-01-20 11:44 Mike Pagano
2024-01-12 22:29 Mike Pagano

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=1706309040.7ebd3d5eb40bc16b8efe35e288abc36fb859c16c.mpagano@gentoo \
    --to=mpagano@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /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