From: Oscar Salvador <osalvador@suse.de>
To: Donet Tom <donettom@linux.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Muchun Song <muchun.song@linux.dev>,
"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Ritesh Harjani <ritesh.list@gmail.com>,
Mike Rapoport <rppt@kernel.org>,
David Hildenbrand <david@redhat.com>,
Matthew Wilcox <willy@infradead.org>,
Tony Battersby <tonyb@cybernetics.com>,
"Aneesh Kumar K . V" <aneesh.kumar@kernel.org>,
Nicholas Piggin <npiggin@gmail.com>,
Alexei Starovoitov <ast@kernel.org>,
Andy Lutomirski <luto@kernel.org>
Subject: Re: [PATCH v2] fs/hugetlbfs/inode.c: Ensure generic_hugetlb_get_unmapped_area() returns higher address than mmap_min_addr
Date: Tue, 9 Jul 2024 11:56:25 +0200 [thread overview]
Message-ID: <Zo0JSVzKKmG_1ADQ@localhost.localdomain> (raw)
In-Reply-To: <20240709092122.41232-1-donettom@linux.ibm.com>
On Tue, Jul 09, 2024 at 04:21:22AM -0500, Donet Tom wrote:
> generic_hugetlb_get_unmapped_area() was returning an address less
> than mmap_min_addr if the mmap argument addr, after alignment, was
> less than mmap_min_addr, causing mmap to fail.
>
> This is because current generic_hugetlb_get_unmapped_area() code does
> not take into account mmap_min_addr.
>
> This patch ensures that generic_hugetlb_get_unmapped_area() always returns
> an address that is greater than mmap_min_addr. Additionally, similar to
> generic_get_unmapped_area(), vm_end_gap() checks are included to ensure
> that the address is within the limit.
Hi Donet,
jfyi: I am already working on other parts of the kernel to avoid hugetlb code
duplication vs mm core.
I am also working on getting rid of hugetlb-unmapped_area specific code
[1].
I still need to perform some more tests but looks promising
code-deletion-wise:
arch/parisc/mm/hugetlbpage.c | 23 -------
arch/powerpc/mm/book3s64/slice.c | 49 ++++++++------
arch/s390/mm/hugetlbpage.c | 84 ------------------------
arch/s390/mm/mmap.c | 14 +++-
arch/sparc/kernel/sys_sparc_32.c | 16 +++--
arch/sparc/kernel/sys_sparc_64.c | 36 ++++++++---
arch/sparc/mm/hugetlbpage.c | 108 -------------------------------
arch/x86/kernel/sys_x86_64.c | 27 +++++---
arch/x86/mm/hugetlbpage.c | 100 ----------------------------
fs/hugetlbfs/inode.c | 97 ++-------------------------
include/linux/hugetlb.h | 10 +++
mm/mmap.c | 25 ++++++-
12 files changed, 139 insertions(+), 450 deletions(-)
I plan to post it in a day or two.
[1] https://github.com/leberus/linux/tree/hugetlb-unmapped-area
--
Oscar Salvador
SUSE Labs
next prev parent reply other threads:[~2024-07-09 9:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-09 9:21 Donet Tom
2024-07-09 9:56 ` Oscar Salvador [this message]
2024-07-09 13:44 ` Donet Tom
2024-07-09 14:02 ` Oscar Salvador
2024-07-09 10:34 ` Kirill A . Shutemov
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=Zo0JSVzKKmG_1ADQ@localhost.localdomain \
--to=osalvador@suse.de \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@kernel.org \
--cc=ast@kernel.org \
--cc=david@redhat.com \
--cc=donettom@linux.ibm.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=luto@kernel.org \
--cc=muchun.song@linux.dev \
--cc=npiggin@gmail.com \
--cc=ritesh.list@gmail.com \
--cc=rppt@kernel.org \
--cc=tonyb@cybernetics.com \
--cc=willy@infradead.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