]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
selftests/mm: mark unused arguments with __unused
authorMuhammad Usama Anjum <usama.anjum@collabora.com>
Thu, 31 Jul 2025 16:01:30 +0000 (21:01 +0500)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 18 Aug 2025 05:08:26 +0000 (22:08 -0700)
Mark the arguments which cannot be removed with __unused attribute.

Link: https://lkml.kernel.org/r/20250731160132.1795351-7-usama.anjum@collabora.com
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Barry Song <baohua@kernel.org>
Cc: David Hildenbrand <david@redhat.com>
Cc: Dev Jain <dev.jain@arm.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Leon Romanovsky <leon@kernel.org>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Mariano Pache <npache@redhat.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/selftests/mm/cow.c
tools/testing/selftests/mm/memfd_secret.c
tools/testing/selftests/mm/pfnmap.c
tools/testing/selftests/mm/uffd-common.c
tools/testing/selftests/mm/uffd-unit-tests.c

index 681f6e3752a26ecef66db8e5a47bd7a04bf6f54b..90ee5779662f3db16c8d11fbb2696a1b372e87b9 100644 (file)
@@ -253,12 +253,12 @@ close_comm_pipes:
        close_comm_pipes(&comm_pipes);
 }
 
-static void test_cow_in_parent(char *mem, size_t size, bool is_hugetlb)
+static void test_cow_in_parent(char *mem, size_t size, bool __unused is_hugetlb)
 {
        do_test_cow_in_parent(mem, size, false, child_memcmp_fn, false);
 }
 
-static void test_cow_in_parent_mprotect(char *mem, size_t size, bool is_hugetlb)
+static void test_cow_in_parent_mprotect(char *mem, size_t size, bool __unused is_hugetlb)
 {
        do_test_cow_in_parent(mem, size, true, child_memcmp_fn, false);
 }
@@ -734,36 +734,36 @@ free_tmp:
        free(tmp);
 }
 
-static void test_ro_pin_on_shared(char *mem, size_t size, bool is_hugetlb)
+static void test_ro_pin_on_shared(char *mem, size_t size, bool __unused is_hugetlb)
 {
        do_test_ro_pin(mem, size, RO_PIN_TEST_SHARED, false);
 }
 
-static void test_ro_fast_pin_on_shared(char *mem, size_t size, bool is_hugetlb)
+static void test_ro_fast_pin_on_shared(char *mem, size_t size, bool __unused is_hugetlb)
 {
        do_test_ro_pin(mem, size, RO_PIN_TEST_SHARED, true);
 }
 
 static void test_ro_pin_on_ro_previously_shared(char *mem, size_t size,
-               bool is_hugetlb)
+               bool __unused is_hugetlb)
 {
        do_test_ro_pin(mem, size, RO_PIN_TEST_PREVIOUSLY_SHARED, false);
 }
 
 static void test_ro_fast_pin_on_ro_previously_shared(char *mem, size_t size,
-               bool is_hugetlb)
+               bool __unused is_hugetlb)
 {
        do_test_ro_pin(mem, size, RO_PIN_TEST_PREVIOUSLY_SHARED, true);
 }
 
 static void test_ro_pin_on_ro_exclusive(char *mem, size_t size,
-               bool is_hugetlb)
+               bool __unused is_hugetlb)
 {
        do_test_ro_pin(mem, size, RO_PIN_TEST_RO_EXCLUSIVE, false);
 }
 
 static void test_ro_fast_pin_on_ro_exclusive(char *mem, size_t size,
-               bool is_hugetlb)
+               bool __unused is_hugetlb)
 {
        do_test_ro_pin(mem, size, RO_PIN_TEST_RO_EXCLUSIVE, true);
 }
@@ -1522,12 +1522,12 @@ static void test_cow(char *mem, const char *smem, size_t size)
        free(old);
 }
 
-static void test_ro_pin(char *mem, const char *smem, size_t size)
+static void test_ro_pin(char *mem, const char __unused *smem, size_t size)
 {
        do_test_ro_pin(mem, size, RO_PIN_TEST, false);
 }
 
-static void test_ro_fast_pin(char *mem, const char *smem, size_t size)
+static void test_ro_fast_pin(char *mem, const char __unused *smem, size_t size)
 {
        do_test_ro_pin(mem, size, RO_PIN_TEST, true);
 }
index 836383f63b630e5eb7071a4eba1e334728994d48..7117cc0f56dbb38992022292032aafebc3297c95 100644 (file)
@@ -123,7 +123,7 @@ close_pipe:
        close(pipefd[1]);
 }
 
-static void try_process_vm_read(int fd, int pipefd[2])
+static void try_process_vm_read(int __unused fd, int pipefd[2])
 {
        struct iovec liov, riov;
        char buf[64];
@@ -147,7 +147,7 @@ static void try_process_vm_read(int fd, int pipefd[2])
        exit(KSFT_FAIL);
 }
 
-static void try_ptrace(int fd, int pipefd[2])
+static void try_ptrace(int __unused fd, int pipefd[2])
 {
        pid_t ppid = getppid();
        int status;
index 88659f0a90eaa17b197425661bbe05d54e1c7ab3..825598b5a374016175ffd9a48c038ab826a75988 100644 (file)
@@ -28,7 +28,7 @@
 static sigjmp_buf sigjmp_buf_env;
 static char *file = "/dev/mem";
 
-static void signal_handler(int sig)
+static void signal_handler(int __unused sig)
 {
        siglongjmp(sigjmp_buf_env, -EFAULT);
 }
index 815c22114b57e972ca0e202989fef1483c034477..e309ec886fa72ed86984a37aba56fba542f45dfc 100644 (file)
@@ -46,7 +46,7 @@ static void anon_release_pages(char *rel_area)
                err("madvise(MADV_DONTNEED) failed");
 }
 
-static int anon_allocate_area(void **alloc_area, bool is_src)
+static int anon_allocate_area(void **alloc_area, bool __unused is_src)
 {
        *alloc_area = mmap(NULL, nr_pages * page_size, PROT_READ | PROT_WRITE,
                           MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
@@ -57,7 +57,8 @@ static int anon_allocate_area(void **alloc_area, bool is_src)
        return 0;
 }
 
-static void noop_alias_mapping(__u64 *start, size_t len, unsigned long offset)
+static void noop_alias_mapping(__u64 __unused *start, size_t __unused len,
+                              unsigned long __unused offset)
 {
 }
 
@@ -108,7 +109,7 @@ static int hugetlb_allocate_area(void **alloc_area, bool is_src)
        return 0;
 }
 
-static void hugetlb_alias_mapping(__u64 *start, size_t len, unsigned long offset)
+static void hugetlb_alias_mapping(__u64 *start, size_t __unused len, unsigned long offset)
 {
        if (!map_shared)
                return;
@@ -167,12 +168,12 @@ static int shmem_allocate_area(void **alloc_area, bool is_src)
        return 0;
 }
 
-static void shmem_alias_mapping(__u64 *start, size_t len, unsigned long offset)
+static void shmem_alias_mapping(__u64 *start, size_t __unused len, unsigned long offset)
 {
        *start = (unsigned long)area_dst_alias + offset;
 }
 
-static void shmem_check_pmd_mapping(void *p, int expect_nr_hpages)
+static void shmem_check_pmd_mapping(void __unused *p, int expect_nr_hpages)
 {
        if (!check_huge_shmem(area_dst_alias, expect_nr_hpages,
                              read_pmd_pagesize()))
index df7b82bbebaadc7c36118351727ad5cb1215c9e5..ee9b407e893e1279c07d6b5c1cb26300cd7045f9 100644 (file)
@@ -361,7 +361,7 @@ static int pagemap_test_fork(int uffd, bool with_event, bool test_pin)
        return result;
 }
 
-static void uffd_wp_unpopulated_test(uffd_test_args_t *args)
+static void uffd_wp_unpopulated_test(uffd_test_args_t __unused *args)
 {
        uint64_t value;
        int pagemap_fd;
@@ -487,7 +487,7 @@ static void uffd_wp_fork_with_event_test(uffd_test_args_t *args)
        uffd_wp_fork_test_common(args, true);
 }
 
-static void uffd_wp_fork_pin_test_common(uffd_test_args_t *args,
+static void uffd_wp_fork_pin_test_common(uffd_test_args_t __unused *args,
                                         bool with_event)
 {
        int pagemap_fd;
@@ -631,24 +631,24 @@ static void uffd_minor_test_common(bool test_collapse, bool test_wp)
                uffd_test_pass();
 }
 
-void uffd_minor_test(uffd_test_args_t *args)
+void uffd_minor_test(uffd_test_args_t __unused *args)
 {
        uffd_minor_test_common(false, false);
 }
 
-void uffd_minor_wp_test(uffd_test_args_t *args)
+void uffd_minor_wp_test(uffd_test_args_t __unused *args)
 {
        uffd_minor_test_common(false, true);
 }
 
-void uffd_minor_collapse_test(uffd_test_args_t *args)
+void uffd_minor_collapse_test(uffd_test_args_t __unused *args)
 {
        uffd_minor_test_common(true, false);
 }
 
 static sigjmp_buf jbuf, *sigbuf;
 
-static void sighndl(int sig, siginfo_t *siginfo, void *ptr)
+static void sighndl(int sig, siginfo_t __unused *siginfo, void __unused *ptr)
 {
        if (sig == SIGBUS) {
                if (sigbuf)
@@ -824,12 +824,12 @@ static void uffd_sigbus_test_common(bool wp)
                uffd_test_pass();
 }
 
-static void uffd_sigbus_test(uffd_test_args_t *args)
+static void uffd_sigbus_test(uffd_test_args_t __unused *args)
 {
        uffd_sigbus_test_common(false);
 }
 
-static void uffd_sigbus_wp_test(uffd_test_args_t *args)
+static void uffd_sigbus_wp_test(uffd_test_args_t __unused *args)
 {
        uffd_sigbus_test_common(true);
 }
@@ -877,12 +877,12 @@ static void uffd_events_test_common(bool wp)
                uffd_test_pass();
 }
 
-static void uffd_events_test(uffd_test_args_t *args)
+static void uffd_events_test(uffd_test_args_t __unused *args)
 {
        uffd_events_test_common(false);
 }
 
-static void uffd_events_wp_test(uffd_test_args_t *args)
+static void uffd_events_wp_test(uffd_test_args_t __unused *args)
 {
        uffd_events_test_common(true);
 }
@@ -950,7 +950,7 @@ uffd_register_detect_zeropage(int uffd, void *addr, uint64_t len)
 }
 
 /* exercise UFFDIO_ZEROPAGE */
-static void uffd_zeropage_test(uffd_test_args_t *args)
+static void uffd_zeropage_test(uffd_test_args_t __unused *args)
 {
        bool has_zeropage;
        int i;
@@ -1006,7 +1006,7 @@ static void do_uffdio_poison(int uffd, unsigned long offset)
 }
 
 static void uffd_poison_handle_fault(
-       struct uffd_msg *msg, struct uffd_args *args)
+       struct uffd_msg *msg, struct uffd_args __unused *args)
 {
        unsigned long offset;
 
@@ -1030,7 +1030,7 @@ static void uffd_poison_handle_fault(
 /* Make sure to cover odd/even, and minimum duplications */
 #define  UFFD_POISON_TEST_NPAGES  4
 
-static void uffd_poison_test(uffd_test_args_t *targs)
+static void uffd_poison_test(uffd_test_args_t __unused *targs)
 {
        pthread_t uffd_mon;
        char c;
@@ -1126,7 +1126,7 @@ static void uffd_move_pmd_handle_fault(struct uffd_msg *msg,
 }
 
 static void
-uffd_move_test_common(uffd_test_args_t *targs, unsigned long chunk_size,
+uffd_move_test_common(uffd_test_args_t __unused *targs, unsigned long chunk_size,
                      void (*handle_fault)(struct uffd_msg *msg, struct uffd_args *args))
 {
        unsigned long nr;
@@ -1359,7 +1359,7 @@ static void uffd_consume_message(void)
        while (uffd_read_msg(&msg));
 }
 
-static void uffd_mmap_changing_test(uffd_test_args_t *targs)
+static void uffd_mmap_changing_test(uffd_test_args_t __unused *targs)
 {
        /*
         * This stores the real PID (which can be different from how tid is