diff options
author | Brian Atkinson <[email protected]> | 2022-03-14 13:37:39 -0600 |
---|---|---|
committer | GitHub <[email protected]> | 2022-03-14 12:37:39 -0700 |
commit | becc717f6143caf80bad6879b6c6402538ecae89 (patch) | |
tree | bfca8c4127635dbb2041877808991a71c75b25ea /config | |
parent | dad2b19fffda43894a005a042055e268fe6b32e3 (diff) |
Adding ZERO_PAGE detection
On some architectures ZERO_PAGE is unavailable because it references
a GPL exported symbol of empty_zero_page. Originally e08b993 removed
the call to PAGE_ZERO(0) for assignment to the abd_zero_page. However,
a simple check can be done to avoid a kernel allocation and free for
the abd_zero_page if ZERO_PAGE is available.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Brian Atkinson <[email protected]>
Closes #13199
Diffstat (limited to 'config')
-rw-r--r-- | config/kernel-zero_page.m4 | 27 | ||||
-rw-r--r-- | config/kernel.m4 | 2 |
2 files changed, 29 insertions, 0 deletions
diff --git a/config/kernel-zero_page.m4 b/config/kernel-zero_page.m4 new file mode 100644 index 000000000..1461781ac --- /dev/null +++ b/config/kernel-zero_page.m4 @@ -0,0 +1,27 @@ +dnl # +dnl # ZERO_PAGE() is an alias for emtpy_zero_page. On certain architectures +dnl # this is a GPL exported variable. +dnl # + +dnl # +dnl # Checking if ZERO_PAGE is exported GPL-only +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_ZERO_PAGE], [ + ZFS_LINUX_TEST_SRC([zero_page], [ + #include <asm/pgtable.h> + ], [ + struct page *p __attribute__ ((unused)); + p = ZERO_PAGE(0); + ], [], [ZFS_META_LICENSE]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_ZERO_PAGE], [ + AC_MSG_CHECKING([whether ZERO_PAGE() is GPL-only]) + ZFS_LINUX_TEST_RESULT([zero_page_license], [ + AC_MSG_RESULT(no) + ], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_ZERO_PAGE_GPL_ONLY, 1, + [ZERO_PAGE() is GPL-only]) + ]) +]) diff --git a/config/kernel.m4 b/config/kernel.m4 index 3122e9dba..d1d3dede1 100644 --- a/config/kernel.m4 +++ b/config/kernel.m4 @@ -137,6 +137,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [ ZFS_AC_KERNEL_SRC_PAGEMAP_FOLIO_WAIT_BIT ZFS_AC_KERNEL_SRC_ADD_DISK ZFS_AC_KERNEL_SRC_KTHREAD + ZFS_AC_KERNEL_SRC_ZERO_PAGE AC_MSG_CHECKING([for available kernel interfaces]) ZFS_LINUX_TEST_COMPILE_ALL([kabi]) @@ -247,6 +248,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [ ZFS_AC_KERNEL_PAGEMAP_FOLIO_WAIT_BIT ZFS_AC_KERNEL_ADD_DISK ZFS_AC_KERNEL_KTHREAD + ZFS_AC_KERNEL_ZERO_PAGE ]) dnl # |