]> www.infradead.org Git - users/willy/xarray.git/commitdiff
selftests/mm: remove unnecessary ia64 code and comment
authorJinjiang Tu <tujinjiang@huawei.com>
Mon, 19 Aug 2024 13:06:09 +0000 (21:06 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 4 Sep 2024 04:15:38 +0000 (21:15 -0700)
IA64 has gone with commit cf8e8658100d ("arch: Remove Itanium (IA-64)
architecture"), so remove unnecessary ia64 special mm code and comment in
selftests too.

Link: https://lkml.kernel.org/r/20240819130609.3386195-1-tujinjiang@huawei.com
Signed-off-by: Jinjiang Tu <tujinjiang@huawei.com>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Nanyong Sun <sunnanyong@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/selftests/mm/Makefile
tools/testing/selftests/mm/hugepage-mmap.c
tools/testing/selftests/mm/hugepage-shm.c
tools/testing/selftests/mm/hugepage-vmemmap.c
tools/testing/selftests/mm/map_hugetlb.c
tools/testing/selftests/mm/run_vmtests.sh

index cfad627e8d94de4a7ac67bf870dc91774ce7294c..0533c5ee0b3e74e96a12df48cd8fc44c2e56d0d9 100644 (file)
@@ -112,7 +112,7 @@ endif
 
 endif
 
-ifneq (,$(filter $(ARCH),arm64 ia64 mips64 parisc64 powerpc riscv64 s390x sparc64 x86_64 s390))
+ifneq (,$(filter $(ARCH),arm64 mips64 parisc64 powerpc riscv64 s390x sparc64 x86_64 s390))
 TEST_GEN_FILES += va_high_addr_switch
 TEST_GEN_FILES += virtual_address_range
 TEST_GEN_FILES += write_to_hugetlbfs
index 267eea2e0e0bff91af5709465a06a51369bb9deb..3b1b532f1cbbc1a95b07e02c2a4c0759c93406d4 100644 (file)
@@ -8,13 +8,6 @@
  * like /mnt) using the command mount -t hugetlbfs nodev /mnt. In this
  * example, the app is requesting memory of size 256MB that is backed by
  * huge pages.
- *
- * For the ia64 architecture, the Linux kernel reserves Region number 4 for
- * huge pages.  That means that if one requires a fixed address, a huge page
- * aligned address starting with 0x800000... will be required.  If a fixed
- * address is not required, the kernel will select an address in the proper
- * range.
- * Other architectures, such as ppc64, i386 or x86_64 are not so constrained.
  */
 #define _GNU_SOURCE
 #include <stdlib.h>
 #define LENGTH (256UL*1024*1024)
 #define PROTECTION (PROT_READ | PROT_WRITE)
 
-/* Only ia64 requires this */
-#ifdef __ia64__
-#define ADDR (void *)(0x8000000000000000UL)
-#define FLAGS (MAP_SHARED | MAP_FIXED)
-#else
-#define ADDR (void *)(0x0UL)
-#define FLAGS (MAP_SHARED)
-#endif
-
 static void check_bytes(char *addr)
 {
        ksft_print_msg("First hex is %x\n", *((unsigned int *)addr));
@@ -74,7 +58,7 @@ int main(void)
        if (fd < 0)
                ksft_exit_fail_msg("memfd_create() failed: %s\n", strerror(errno));
 
-       addr = mmap(ADDR, LENGTH, PROTECTION, FLAGS, fd, 0);
+       addr = mmap(NULL, LENGTH, PROTECTION, MAP_SHARED, fd, 0);
        if (addr == MAP_FAILED) {
                close(fd);
                ksft_exit_fail_msg("mmap(): %s\n", strerror(errno));
index 478bb1e989e9f3b58b61c252587a2978f0f55a0d..ef06260802b50f793e438b8a527e5c89399c2e64 100644 (file)
@@ -8,13 +8,6 @@
  * SHM_HUGETLB in the shmget system call to inform the kernel that it is
  * requesting huge pages.
  *
- * For the ia64 architecture, the Linux kernel reserves Region number 4 for
- * huge pages.  That means that if one requires a fixed address, a huge page
- * aligned address starting with 0x800000... will be required.  If a fixed
- * address is not required, the kernel will select an address in the proper
- * range.
- * Other architectures, such as ppc64, i386 or x86_64 are not so constrained.
- *
  * Note: The default shared memory limit is quite low on many kernels,
  * you may need to increase it via:
  *
 
 #define dprintf(x)  printf(x)
 
-/* Only ia64 requires this */
-#ifdef __ia64__
-#define ADDR (void *)(0x8000000000000000UL)
-#define SHMAT_FLAGS (SHM_RND)
-#else
-#define ADDR (void *)(0x0UL)
-#define SHMAT_FLAGS (0)
-#endif
-
 int main(void)
 {
        int shmid;
@@ -61,7 +45,7 @@ int main(void)
        }
        printf("shmid: 0x%x\n", shmid);
 
-       shmaddr = shmat(shmid, ADDR, SHMAT_FLAGS);
+       shmaddr = shmat(shmid, NULL, 0);
        if (shmaddr == (char *)-1) {
                perror("Shared memory attach failure");
                shmctl(shmid, IPC_RMID, NULL);
index 894d28c3dd4785fcd4d14eae8caefc50a23aaa13..df366a4d1b92db75618baf6041b209c0e7480a61 100644 (file)
 #define PM_PFRAME_BITS         55
 #define PM_PFRAME_MASK         ~((1UL << PM_PFRAME_BITS) - 1)
 
-/*
- * For ia64 architecture, Linux kernel reserves Region number 4 for hugepages.
- * That means the addresses starting with 0x800000... will need to be
- * specified.  Specifying a fixed address is not required on ppc64, i386
- * or x86_64.
- */
-#ifdef __ia64__
-#define MAP_ADDR               (void *)(0x8000000000000000UL)
-#define MAP_FLAGS              (MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB | MAP_FIXED)
-#else
-#define MAP_ADDR               NULL
-#define MAP_FLAGS              (MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB)
-#endif
-
 static size_t pagesize;
 static size_t maplength;
 
@@ -113,7 +99,8 @@ int main(int argc, char **argv)
                exit(1);
        }
 
-       addr = mmap(MAP_ADDR, maplength, PROT_READ | PROT_WRITE, MAP_FLAGS, -1, 0);
+       addr = mmap(NULL, maplength, PROT_READ | PROT_WRITE,
+                       MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, -1, 0);
        if (addr == MAP_FAILED) {
                perror("mmap");
                exit(1);
index a1f005a90a4f0deb5633702d389d16b2a7c0d3bb..b47399feab53849d1263d0d982778b5c731cd55d 100644 (file)
@@ -4,11 +4,6 @@
  * system call with MAP_HUGETLB flag.  Before running this program make
  * sure the administrator has allocated enough default sized huge pages
  * to cover the 256 MB allocation.
- *
- * For ia64 architecture, Linux kernel reserves Region number 4 for hugepages.
- * That means the addresses starting with 0x800000... will need to be
- * specified.  Specifying a fixed address is not required on ppc64, i386
- * or x86_64.
  */
 #include <stdlib.h>
 #include <stdio.h>
 #define LENGTH (256UL*1024*1024)
 #define PROTECTION (PROT_READ | PROT_WRITE)
 
-/* Only ia64 requires this */
-#ifdef __ia64__
-#define ADDR (void *)(0x8000000000000000UL)
-#define FLAGS (MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB | MAP_FIXED)
-#else
-#define ADDR (void *)(0x0UL)
-#define FLAGS (MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB)
-#endif
-
 static void check_bytes(char *addr)
 {
        ksft_print_msg("First hex is %x\n", *((unsigned int *)addr));
@@ -60,7 +46,7 @@ int main(int argc, char **argv)
        void *addr;
        size_t hugepage_size;
        size_t length = LENGTH;
-       int flags = FLAGS;
+       int flags = MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB;
        int shift = 0;
 
        hugepage_size = default_huge_page_size();
@@ -85,7 +71,7 @@ int main(int argc, char **argv)
                ksft_print_msg("Default size hugepages\n");
        ksft_print_msg("Mapping %lu Mbytes\n", (unsigned long)length >> 20);
 
-       addr = mmap(ADDR, length, PROTECTION, flags, -1, 0);
+       addr = mmap(NULL, length, PROTECTION, flags, -1, 0);
        if (addr == MAP_FAILED)
                ksft_exit_fail_msg("mmap: %s\n", strerror(errno));
 
index 36045edb10dea0bd6992ba6d07b74db3647fe4da..c5797ad1d37b68beb5c8482350328d6cb6aca493 100755 (executable)
@@ -189,7 +189,7 @@ else
 fi
 
 # filter 64bit architectures
-ARCH64STR="arm64 ia64 mips64 parisc64 ppc64 ppc64le riscv64 s390x sparc64 x86_64"
+ARCH64STR="arm64 mips64 parisc64 ppc64 ppc64le riscv64 s390x sparc64 x86_64"
 if [ -z "$ARCH" ]; then
        ARCH=$(uname -m 2>/dev/null | sed -e 's/aarch64.*/arm64/')
 fi