* + mm-csky-introduce-arch_mmap_hint.patch added to mm-unstable branch
@ 2024-12-12 0:13 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2024-12-12 0:13 UTC (permalink / raw)
To: mm-commits, ysato, yang, vbabka, tsbogend, tglx, riel, minchan,
linux, leitao, jcmvbkbc, jason.andryuk, James.Bottomley, glaubitz,
david, davem, dave.hansen, dalias, chris, bp, bhelgaas, andreas,
kaleshsingh, akpm
The patch titled
Subject: mm: csky: introduce arch_mmap_hint()
has been added to the -mm mm-unstable branch. Its filename is
mm-csky-introduce-arch_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-csky-introduce-arch_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 <kaleshsingh@google.com>
Subject: mm: csky: introduce arch_mmap_hint()
Date: Wed, 11 Dec 2024 15:27:44 -0800
Introduce csky 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-7-kaleshsingh@google.com
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
Cc: Andreas Larsson <andreas@gaisler.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Borislav Petkov (AMD) <bp@alien8.de>
Cc: Breno Leitao <leitao@debian.org>
Cc: Chris Zankel <chris@zankel.net>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Jason Andryuk <jason.andryuk@amd.com>
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Rich Felker <dalias@libc.org>
Cc: Rik van Riel <riel@surriel.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Yang Shi <yang@os.amperecomputing.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
arch/csky/abiv1/inc/abi/pgtable-bits.h | 1
arch/csky/abiv1/mmap.c | 68 ++++++++++++-----------
2 files changed, 38 insertions(+), 31 deletions(-)
--- a/arch/csky/abiv1/inc/abi/pgtable-bits.h~mm-csky-introduce-arch_mmap_hint
+++ a/arch/csky/abiv1/inc/abi/pgtable-bits.h
@@ -51,5 +51,6 @@
((offset) << 10)})
#define HAVE_ARCH_UNMAPPED_AREA
+#define HAVE_ARCH_MMAP_HINT
#endif /* __ASM_CSKY_PGTABLE_BITS_H */
--- a/arch/csky/abiv1/mmap.c~mm-csky-introduce-arch_mmap_hint
+++ a/arch/csky/abiv1/mmap.c
@@ -13,6 +13,39 @@
((((addr)+SHMLBA-1)&~(SHMLBA-1)) + \
(((pgoff)<<PAGE_SHIFT) & (SHMLBA-1)))
+unsigned long arch_mmap_hint(struct file *filp, unsigned long addr,
+ unsigned long len, unsigned long pgoff,
+ unsigned long flags)
+{
+ bool do_align;
+
+ if (len > TASK_SIZE)
+ return -ENOMEM;
+
+ /*
+ * We only need to do colour alignment if either the I or D
+ * caches alias.
+ */
+ do_align = filp || (flags & MAP_SHARED);
+
+ /*
+ * We enforce the MAP_FIXED case.
+ */
+ if (flags & MAP_FIXED) {
+ if (flags & MAP_SHARED &&
+ (addr - (pgoff << PAGE_SHIFT)) & (SHMLBA - 1))
+ return -EINVAL;
+ return addr;
+ }
+
+ if (do_align)
+ addr = COLOUR_ALIGN(addr, pgoff);
+ else
+ addr = PAGE_ALIGN(addr);
+
+ return generic_mmap_hint(filp, addr, len, pgoff, flags);
+}
+
/*
* We need to ensure that shared mappings are correctly aligned to
* avoid aliasing issues with VIPT caches. We need to ensure that
@@ -27,8 +60,7 @@ arch_get_unmapped_area(struct file *filp
unsigned long flags, vm_flags_t vm_flags)
{
struct mm_struct *mm = current->mm;
- struct vm_area_struct *vma;
- int do_align = 0;
+ bool do_align;
struct vm_unmapped_area_info info = {
.length = len,
.low_limit = mm->mmap_base,
@@ -36,37 +68,11 @@ arch_get_unmapped_area(struct file *filp
.align_offset = pgoff << PAGE_SHIFT
};
- /*
- * We only need to do colour alignment if either the I or D
- * caches alias.
- */
- do_align = filp || (flags & MAP_SHARED);
-
- /*
- * We enforce the MAP_FIXED case.
- */
- if (flags & MAP_FIXED) {
- if (flags & MAP_SHARED &&
- (addr - (pgoff << PAGE_SHIFT)) & (SHMLBA - 1))
- return -EINVAL;
+ addr = arch_mmap_hint(filp, addr, len, pgoff, flags);
+ if (addr)
return addr;
- }
-
- if (len > TASK_SIZE)
- return -ENOMEM;
-
- if (addr) {
- if (do_align)
- addr = COLOUR_ALIGN(addr, pgoff);
- else
- addr = PAGE_ALIGN(addr);
-
- vma = find_vma(mm, addr);
- if (TASK_SIZE - len >= addr &&
- (!vma || addr + len <= vm_start_gap(vma)))
- return addr;
- }
+ do_align = filp || (flags & MAP_SHARED);
info.align_mask = do_align ? (PAGE_MASK & (SHMLBA - 1)) : 0;
return vm_unmapped_area(&info);
}
_
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-12-12 0:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-12 0:13 + mm-csky-introduce-arch_mmap_hint.patch added to mm-unstable branch Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.