From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1179510E3 for ; Thu, 12 Dec 2024 00:13:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733962398; cv=none; b=EUZx2SKQ2bj8h/vhByBLRu2JNFfkxY4FV1lbcd+5wTLBMGw6WXVCM6yxqqG8iUlkVzsMriT0xvp5sFZ7ESwVvOks31q3ApWCzcRGSXqzm3XeucHcaZkphJ/O41VIZ6AxFRoPM7RziKBTPXOpn7mVCYSl2FF1tXTofgNIvaYZSlQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733962398; c=relaxed/simple; bh=gpYXoaTB9M3pRqU5d8ryhcHyLnBRIWPbQZssb2cKtBA=; h=Date:To:From:Subject:Message-Id; b=YWpM0yXNIsh0WoUv0vKBNXdUNmSse3k9WAOa3MwSeDMFlNdu9cuEPZBMNUDA8vLKC8e23MpyGjHjUwJGb0Kb1ww48s6fjkeDZAJHfwlgITnqEcdxDzd8Duat1FCwBA5mFYXwt8tmEIvZnirHw+jBA2bXjKFk1vFdxHb6XE7mmoc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=HGUuz5/w; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="HGUuz5/w" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8F63C4CED2; Thu, 12 Dec 2024 00:13:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1733962397; bh=gpYXoaTB9M3pRqU5d8ryhcHyLnBRIWPbQZssb2cKtBA=; h=Date:To:From:Subject:From; b=HGUuz5/w60JrcIXIj/i01YX2kul6tGwEsIrQ39EfjTHk3RtOFk7x7CbrDN/8BjA8l qLH08lNY5uiqV8y0T9gMFaqlhed1iF47LLGvUewczcPcJeg+bsFTzyzZdUzoKCOHDw ABNMnJH8auCZ/TeXS7AvpXInFClXtxVe56YyEr+I= Date: Wed, 11 Dec 2024 16:13:17 -0800 To: mm-commits@vger.kernel.org,ysato@users.sourceforge.jp,yang@os.amperecomputing.com,vbabka@suse.cz,tsbogend@alpha.franken.de,tglx@linutronix.de,riel@surriel.com,minchan@kernel.org,linux@armlinux.org.uk,leitao@debian.org,jcmvbkbc@gmail.com,jason.andryuk@amd.com,James.Bottomley@HansenPartnership.com,glaubitz@physik.fu-berlin.de,david@redhat.com,davem@davemloft.net,dave.hansen@linux.intel.com,dalias@libc.org,chris@zankel.net,bp@alien8.de,bhelgaas@google.com,andreas@gaisler.com,kaleshsingh@google.com,akpm@linux-foundation.org From: Andrew Morton Subject: + mm-s390-use-generic_mmap_hint.patch added to mm-unstable branch Message-Id: <20241212001317.D8F63C4CED2@smtp.kernel.org> Precedence: bulk X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: The patch titled Subject: mm: s390: use generic_mmap_hint() has been added to the -mm mm-unstable branch. Its filename is mm-s390-use-generic_mmap_hint.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-s390-use-generic_mmap_hint.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Kalesh Singh Subject: mm: s390: use generic_mmap_hint() Date: Wed, 11 Dec 2024 15:27:48 -0800 Introduce s390 arch_mmap_hint() and define HAVE_ARCH_MMAP_HINT. This is a preparatory patch, no functional change is introduced. Link: https://lkml.kernel.org/r/20241211232754.1583023-11-kaleshsingh@google.com Signed-off-by: Kalesh Singh Cc: Andreas Larsson Cc: Bjorn Helgaas Cc: Borislav Petkov (AMD) Cc: Breno Leitao Cc: Chris Zankel Cc: Dave Hansen Cc: David Hildenbrand Cc: David S. Miller Cc: James Bottomley Cc: Jason Andryuk Cc: John Paul Adrian Glaubitz Cc: Max Filippov Cc: Minchan Kim Cc: Rich Felker Cc: Rik van Riel Cc: Russell King Cc: Thomas Bogendoerfer Cc: Thomas Gleixner Cc: Vlastimil Babka Cc: Yang Shi Cc: Yoshinori Sato Signed-off-by: Andrew Morton --- arch/s390/include/asm/pgtable.h | 1 arch/s390/mm/mmap.c | 51 +++++++++++++----------------- 2 files changed, 24 insertions(+), 28 deletions(-) --- a/arch/s390/include/asm/pgtable.h~mm-s390-use-generic_mmap_hint +++ a/arch/s390/include/asm/pgtable.h @@ -1997,6 +1997,7 @@ extern void s390_reset_cmma(struct mm_st /* s390 has a private copy of get unmapped area to deal with cache synonyms */ #define HAVE_ARCH_UNMAPPED_AREA #define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN +#define HAVE_ARCH_MMAP_HINT #define pmd_pgtable(pmd) \ ((pgtable_t)__va(pmd_val(pmd) & -sizeof(pte_t)*PTRS_PER_PTE)) --- a/arch/s390/mm/mmap.c~mm-s390-use-generic_mmap_hint +++ a/arch/s390/mm/mmap.c @@ -83,28 +83,33 @@ static int get_align_mask(struct file *f return 0; } +unsigned long arch_mmap_hint(struct file *filp, unsigned long addr, + unsigned long len, unsigned long pgoff, + unsigned long flags) +{ + /* requested length too big for entire address space */ + if (len > TASK_SIZE - mmap_min_addr) + return -ENOMEM; + + if (flags & MAP_FIXED) + return addr; + + return generic_mmap_hint(filp, addr, len, pgoff, flags); +} + unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags, vm_flags_t vm_flags) { struct mm_struct *mm = current->mm; - struct vm_area_struct *vma; struct vm_unmapped_area_info info = {}; - if (len > TASK_SIZE - mmap_min_addr) - return -ENOMEM; - - if (flags & MAP_FIXED) + addr = arch_mmap_hint(filp, addr, len, pgoff, flags); + if (IS_ERR_VALUE(addr)) + return addr; + if (addr) goto check_asce_limit; - if (addr) { - addr = PAGE_ALIGN(addr); - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && addr >= mmap_min_addr && - (!vma || addr + len <= vm_start_gap(vma))) - goto check_asce_limit; - } - info.length = len; info.low_limit = mm->mmap_base; info.high_limit = TASK_SIZE; @@ -123,25 +128,15 @@ unsigned long arch_get_unmapped_area_top unsigned long len, unsigned long pgoff, unsigned long flags, vm_flags_t vm_flags) { - struct vm_area_struct *vma; struct mm_struct *mm = current->mm; struct vm_unmapped_area_info info = {}; - /* requested length too big for entire address space */ - if (len > TASK_SIZE - mmap_min_addr) - return -ENOMEM; - - if (flags & MAP_FIXED) - goto check_asce_limit; - /* requesting a specific address */ - if (addr) { - addr = PAGE_ALIGN(addr); - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && addr >= mmap_min_addr && - (!vma || addr + len <= vm_start_gap(vma))) - goto check_asce_limit; - } + addr = arch_mmap_hint(filp, addr, len, pgoff, flags); + if (IS_ERR_VALUE(addr)) + return addr; + if (addr) + goto check_asce_limit; info.flags = VM_UNMAPPED_AREA_TOPDOWN; info.length = len; _ Patches currently in -mm which might be from kaleshsingh@google.com are mm-introduce-generic_mmap_hint.patch mm-x86-introduce-arch_mmap_hint.patch mm-arm-introduce-arch_mmap_hint.patch mm-alpha-introduce-arch_mmap_hint.patch mm-arc-use-generic_mmap_hint.patch mm-csky-introduce-arch_mmap_hint.patch mm-loongarch-introduce-arch_mmap_hint.patch mm-mips-introduce-arch_align_mmap_hint.patch mm-parisc-introduce-arch_align_mmap_hint.patch mm-s390-use-generic_mmap_hint.patch mm-sh-introduce-arch_mmap_hint.patch mm-sparc32-introduce-arch_mmap_hint.patch mm-sparc64-introduce-arch_mmap_hint.patch mm-xtensa-introduce-arch_mmap_hint.patch mm-powerpc-introduce-arch_mmap_hint.patch mm-respect-mmap-hint-before-thp-alignment-if-allocation-is-possible.patch