xref: /freebsd/sys/contrib/openzfs/config/kernel-pin-user-pages.m4 (revision dd21556857e8d40f66bf5ad54754d9d52669ebf7)
1dnl #
2dnl # Check for pin_user_pages_unlocked().
3dnl #
4AC_DEFUN([ZFS_AC_KERNEL_SRC_PIN_USER_PAGES], [
5	ZFS_LINUX_TEST_SRC([pin_user_pages_unlocked], [
6		#include <linux/mm.h>
7	],[
8		unsigned long start = 0;
9		unsigned long nr_pages = 1;
10		struct page **pages = NULL;
11		unsigned int gup_flags = 0;
12		long ret __attribute__ ((unused));
13
14		ret = pin_user_pages_unlocked(start, nr_pages, pages,
15		    gup_flags);
16	])
17])
18
19AC_DEFUN([ZFS_AC_KERNEL_PIN_USER_PAGES], [
20
21	dnl #
22	dnl # Kernal 5.8 introduced the pin_user_pages* interfaces which should
23	dnl # be used for Direct I/O requests.
24	dnl #
25	AC_MSG_CHECKING([whether pin_user_pages_unlocked() is available])
26	ZFS_LINUX_TEST_RESULT([pin_user_pages_unlocked], [
27		AC_MSG_RESULT(yes)
28		AC_DEFINE(HAVE_PIN_USER_PAGES_UNLOCKED, 1,
29		    [pin_user_pages_unlocked() is available])
30	],[
31		AC_MSG_RESULT(no)
32	])
33])
34