linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Donet Tom <donettom@linux.ibm.com>
To: Oscar Salvador <osalvador@suse.de>
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 19:14:38 +0530	[thread overview]
Message-ID: <dc4a8671-b8c2-484f-a83c-03bfc1fbe078@linux.ibm.com> (raw)
In-Reply-To: <Zo0JSVzKKmG_1ADQ@localhost.localdomain>


On 7/9/24 15:26, Oscar Salvador wrote:
> 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
Thank you Oscar.

The issue I am trying to fix will also get fixed by this new changes right.
So should we drop my patch or should we continue it?

-Donet


  reply	other threads:[~2024-07-09 13:45 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
2024-07-09 13:44   ` Donet Tom [this message]
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=dc4a8671-b8c2-484f-a83c-03bfc1fbe078@linux.ibm.com \
    --to=donettom@linux.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@kernel.org \
    --cc=ast@kernel.org \
    --cc=david@redhat.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=osalvador@suse.de \
    --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