Skip to content

Commit

Permalink
kselftest/vm: revert "tools/testing/selftests/vm/userfaultfd.c: use s…
Browse files Browse the repository at this point in the history
…wap() to make code cleaner"

With this change, userfaultfd fails to build with undefined reference
swap() error:

  userfaultfd.c: In function `userfaultfd_stress':
  userfaultfd.c:1530:17: warning: implicit declaration of function `swap'; did you mean `swab'? [-Wimplicit-function-declaration]
   1530 |                 swap(area_src, area_dst);
        |                 ^~~~
        |                 swab
  /usr/bin/ld: /tmp/ccDGOAdV.o: in function `userfaultfd_stress':
  userfaultfd.c:(.text+0x549e): undefined reference to `swap'
  /usr/bin/ld: userfaultfd.c:(.text+0x54bc): undefined reference to `swap'
  collect2: error: ld returned 1 exit status

Revert the commit to fix the problem.

Link: https://lkml.kernel.org/r/[email protected]
Fixes: 2c769ed ("tools/testing/selftests/vm/userfaultfd.c: use swap() to make code cleaner")
Signed-off-by: Shuah Khan <[email protected]>
Cc: Shuah Khan <[email protected]>
Cc: Minghao Chi <[email protected]>

Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
shuahkh authored and torvalds committed Feb 4, 2022
1 parent 6a0fb70 commit 07d2505
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tools/testing/selftests/vm/userfaultfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1417,6 +1417,7 @@ static void userfaultfd_pagemap_test(unsigned int test_pgsize)
static int userfaultfd_stress(void)
{
void *area;
char *tmp_area;
unsigned long nr;
struct uffdio_register uffdio_register;
struct uffd_stats uffd_stats[nr_cpus];
Expand Down Expand Up @@ -1527,9 +1528,13 @@ static int userfaultfd_stress(void)
count_verify[nr], nr);

/* prepare next bounce */
swap(area_src, area_dst);
tmp_area = area_src;
area_src = area_dst;
area_dst = tmp_area;

swap(area_src_alias, area_dst_alias);
tmp_area = area_src_alias;
area_src_alias = area_dst_alias;
area_dst_alias = tmp_area;

uffd_stats_report(uffd_stats, nr_cpus);
}
Expand Down

0 comments on commit 07d2505

Please sign in to comment.