From 6ae7fef5b94275e50cc1dcd48c4ecf3b70d7f9d9 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 28 Jul 2009 15:06:42 -0700 Subject: [PATCH] Update global_page_state() support for 2.6.29 kernels. Basically everything we need to monitor the global memory state of the system is now cleanly available via global_page_state(). The problem is that this interface is still fairly recent, and there has been one change in the page state enum which we need to handle. These changes basically boil down to the following: - If global_page_state() is available we should use it. Several autoconf checks have been added to detect the correct enum names. - If global_page_state() is not available check to see if get_zone_counts() symbol is available and use that. - If the get_zone_counts() symbol is not exported we have no choice be to dynamically aquire it at load time. This is an absolute last resort for old kernel which we don't want to patch to cleanly export the symbol. --- config/spl-build.m4 | 205 +++- configure | 2132 ++++++++++++++++++++++++++----------- include/sys/vmsystm.h | 21 +- module/spl/spl-kmem.c | 79 +- module/splat/splat-kmem.c | 45 +- spl_config.h.in | 25 +- 6 files changed, 1818 insertions(+), 689 deletions(-) diff --git a/config/spl-build.m4 b/config/spl-build.m4 index 79fcd2548..51f7ea376 100644 --- a/config/spl-build.m4 +++ b/config/spl-build.m4 @@ -59,9 +59,11 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [ SPL_AC_NEXT_ONLINE_PGDAT SPL_AC_NEXT_ZONE SPL_AC_PGDAT_LIST - SPL_AC_GET_ZONE_COUNTS SPL_AC_GLOBAL_PAGE_STATE - SPL_AC_ZONE_STAT_ITEM_FIA + SPL_AC_ZONE_STAT_ITEM_FREE + SPL_AC_ZONE_STAT_ITEM_INACTIVE + SPL_AC_ZONE_STAT_ITEM_ACTIVE + SPL_AC_GET_ZONE_COUNTS SPL_AC_2ARGS_VFS_UNLINK SPL_AC_4ARGS_VFS_RENAME SPL_AC_CRED_STRUCT @@ -1005,22 +1007,6 @@ AC_DEFUN([SPL_AC_PGDAT_LIST], [ []) ]) -dnl # -dnl # Proposed API change, -dnl # This symbol is not available in stock kernels. You may build a -dnl # custom kernel with the *-spl-export-symbols.patch which will export -dnl # these symbols for use. If your already rolling a custom kernel for -dnl # your environment this is recommended. -dnl # -AC_DEFUN([SPL_AC_GET_ZONE_COUNTS], [ - SPL_CHECK_SYMBOL_EXPORT( - [get_zone_counts], - [], - [AC_DEFINE(HAVE_GET_ZONE_COUNTS, 1, - [get_zone_counts() is available])], - []) -]) - dnl # dnl # 2.6.18 API change, dnl # First introduced global_page_state() support as an inline. @@ -1028,10 +1014,10 @@ dnl # AC_DEFUN([SPL_AC_GLOBAL_PAGE_STATE], [ AC_MSG_CHECKING([whether global_page_state() is available]) SPL_LINUX_TRY_COMPILE([ - #include + #include ],[ unsigned long state; - state = global_page_state(NR_FREE_PAGES); + state = global_page_state(0); ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_GLOBAL_PAGE_STATE, 1, @@ -1042,28 +1028,183 @@ AC_DEFUN([SPL_AC_GLOBAL_PAGE_STATE], [ ]) dnl # -dnl # 2.6.21 API change, -dnl # Public global zone stats now include free/inactive/active page -dnl # counts. This replaced the priviate get_zone_counts() interface. +dnl # 2.6.21 API change (plus subsequent naming convention changes), +dnl # Public global zone stats now include a free page count. However +dnl # the enumerated names of the counters have changed since this API +dnl # was introduced. We need to deduce the corrent name to use. This +dnl # replaces the priviate get_zone_counts() interface. +dnl # +dnl # NR_FREE_PAGES was available from 2.6.21 to current kernels, which +dnl # is 2.6.30 as of when this was written. dnl # -AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_FIA], [ - AC_MSG_CHECKING([whether free/inactive/active page state is available]) +AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_FREE], [ + AC_MSG_CHECKING([whether page state NR_FREE_PAGES is available]) SPL_LINUX_TRY_COMPILE([ - #include + #include ],[ - enum zone_stat_item i1, i2, i3; - i1 = NR_FREE_PAGES; - i2 = NR_INACTIVE; - i3 = NR_ACTIVE; + enum zone_stat_item zsi; + zsi = NR_FREE_PAGES; ],[ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_ZONE_STAT_ITEM_FIA, 1, - [free/inactive/active page state is available]) + AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES, 1, + [Page state NR_FREE_PAGES is available]) ],[ AC_MSG_RESULT(no) ]) ]) +dnl # +dnl # 2.6.21 API change (plus subsequent naming convention changes), +dnl # Public global zone stats now include an inactive page count. However +dnl # the enumerated names of the counters have changed since this API +dnl # was introduced. We need to deduce the corrent name to use. This +dnl # replaces the priviate get_zone_counts() interface. +dnl # +dnl # NR_INACTIVE was available from 2.6.21 to 2.6.27 and included both +dnl # anonymous and file inactive pages. As of 2.6.28 it was split in +dnl # to NR_INACTIVE_ANON and NR_INACTIVE_FILE. +dnl # +AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_INACTIVE], [ + AC_MSG_CHECKING([whether page state NR_INACTIVE is available]) + SPL_LINUX_TRY_COMPILE([ + #include + ],[ + enum zone_stat_item zsi; + zsi = NR_INACTIVE; + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE, 1, + [Page state NR_INACTIVE is available]) + ],[ + AC_MSG_RESULT(no) + ]) + + AC_MSG_CHECKING([whether page state NR_INACTIVE_ANON is available]) + SPL_LINUX_TRY_COMPILE([ + #include + ],[ + enum zone_stat_item zsi; + zsi = NR_INACTIVE_ANON; + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON, 1, + [Page state NR_INACTIVE_ANON is available]) + ],[ + AC_MSG_RESULT(no) + ]) + + AC_MSG_CHECKING([whether page state NR_INACTIVE_FILE is available]) + SPL_LINUX_TRY_COMPILE([ + #include + ],[ + enum zone_stat_item zsi; + zsi = NR_INACTIVE_FILE; + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE, 1, + [Page state NR_INACTIVE_FILE is available]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + +dnl # +dnl # 2.6.21 API change (plus subsequent naming convention changes), +dnl # Public global zone stats now include an active page count. However +dnl # the enumerated names of the counters have changed since this API +dnl # was introduced. We need to deduce the corrent name to use. This +dnl # replaces the priviate get_zone_counts() interface. +dnl # +dnl # NR_ACTIVE was available from 2.6.21 to 2.6.27 and included both +dnl # anonymous and file active pages. As of 2.6.28 it was split in +dnl # to NR_ACTIVE_ANON and NR_ACTIVE_FILE. +dnl # +AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_ACTIVE], [ + AC_MSG_CHECKING([whether page state NR_ACTIVE is available]) + SPL_LINUX_TRY_COMPILE([ + #include + ],[ + enum zone_stat_item zsi; + zsi = NR_ACTIVE; + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE, 1, + [Page state NR_ACTIVE is available]) + ],[ + AC_MSG_RESULT(no) + ]) + + AC_MSG_CHECKING([whether page state NR_ACTIVE_ANON is available]) + SPL_LINUX_TRY_COMPILE([ + #include + ],[ + enum zone_stat_item zsi; + zsi = NR_ACTIVE_ANON; + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON, 1, + [Page state NR_ACTIVE_ANON is available]) + ],[ + AC_MSG_RESULT(no) + ]) + + AC_MSG_CHECKING([whether page state NR_ACTIVE_FILE is available]) + SPL_LINUX_TRY_COMPILE([ + #include + ],[ + enum zone_stat_item zsi; + zsi = NR_ACTIVE_FILE; + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE, 1, + [Page state NR_ACTIVE_FILE is available]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + +dnl # +dnl # Proposed API change for legacy kernels. +dnl # This symbol is not available in older kernels. For kernels post +dnl # 2.6.21 the global_page_state() API is used to get free/inactive/active +dnl # page state information. This symbol is only used in legacy kernels +dnl # any only as a last resort. +dnl +AC_DEFUN([SPL_AC_GET_ZONE_COUNTS], [ + AC_MSG_CHECKING([whether symbol get_zone_counts is needed]) + SPL_LINUX_TRY_COMPILE([ + ],[ + #if !defined(HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES) + #error "global_page_state needs NR_FREE_PAGES" + #endif + + #if !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE) && \ + !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON) && \ + !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE) + #error "global_page_state needs NR_ACTIVE*" + #endif + + #if !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE) && \ + !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON) && \ + !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE) + #error "global_page_state needs NR_INACTIVE*" + #endif + ],[ + AC_MSG_RESULT(no) + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(NEED_GET_ZONE_COUNTS, 1, + [get_zone_counts() is needed]) + + SPL_CHECK_SYMBOL_EXPORT( + [get_zone_counts], + [], + [AC_DEFINE(HAVE_GET_ZONE_COUNTS, 1, + [get_zone_counts() is available])], + []) + ]) +]) + dnl # dnl # SLES API change, never adopted in mainline, dnl # Third 'struct vfsmount *' argument removed. diff --git a/configure b/configure index a342d73a2..3ed6af191 100755 --- a/configure +++ b/configure @@ -21040,49 +21040,74 @@ _ACEOF - echo "$as_me:$LINENO: checking whether symbol get_zone_counts is exported" >&5 -echo $ECHO_N "checking whether symbol get_zone_counts is exported... $ECHO_C" >&6 - grep -q -E '[[:space:]]get_zone_counts[[:space:]]' \ - $LINUX_OBJ/Module*.symvers 2>/dev/null - rc=$? - if test $rc -ne 0; then - export=0 - for file in ; do - grep -q -E "EXPORT_SYMBOL.*(get_zone_counts)" \ - "$LINUX_OBJ/$file" 2>/dev/null - rc=$? - if test $rc -eq 0; then - export=1 - break; - fi - done - if test $export -eq 0; then - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + echo "$as_me:$LINENO: checking whether global_page_state() is available" >&5 +echo $ECHO_N "checking whether global_page_state() is available... $ECHO_C" >&6 - else - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -cat >>confdefs.h <<\_ACEOF -#define HAVE_GET_ZONE_COUNTS 1 +cat >conftest.c <<_ACEOF +/* confdefs.h. */ _ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + + #include + +int +main (void) +{ + + unsigned long state; + state = global_page_state(0); + + ; + return 0; +} + +_ACEOF + + + rm -Rf build && mkdir -p build + echo "obj-m := conftest.o" >build/Makefile + if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then - fi - else echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define HAVE_GET_ZONE_COUNTS 1 +#define HAVE_GLOBAL_PAGE_STATE 1 _ACEOF - fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + + + +fi + + rm -Rf build - echo "$as_me:$LINENO: checking whether global_page_state() is available" >&5 -echo $ECHO_N "checking whether global_page_state() is available... $ECHO_C" >&6 + + echo "$as_me:$LINENO: checking whether page state NR_FREE_PAGES is available" >&5 +echo $ECHO_N "checking whether page state NR_FREE_PAGES is available... $ECHO_C" >&6 cat >conftest.c <<_ACEOF @@ -21093,14 +21118,14 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #include + #include int main (void) { - unsigned long state; - state = global_page_state(NR_FREE_PAGES); + enum zone_stat_item zsi; + zsi = NR_FREE_PAGES; ; return 0; @@ -21127,7 +21152,7 @@ _ACEOF echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define HAVE_GLOBAL_PAGE_STATE 1 +#define HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES 1 _ACEOF @@ -21147,8 +21172,8 @@ fi - echo "$as_me:$LINENO: checking whether free/inactive/active page state is available" >&5 -echo $ECHO_N "checking whether free/inactive/active page state is available... $ECHO_C" >&6 + echo "$as_me:$LINENO: checking whether page state NR_INACTIVE is available" >&5 +echo $ECHO_N "checking whether page state NR_INACTIVE is available... $ECHO_C" >&6 cat >conftest.c <<_ACEOF @@ -21159,16 +21184,14 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #include + #include int main (void) { - enum zone_stat_item i1, i2, i3; - i1 = NR_FREE_PAGES; - i2 = NR_INACTIVE; - i3 = NR_ACTIVE; + enum zone_stat_item zsi; + zsi = NR_INACTIVE; ; return 0; @@ -21195,7 +21218,7 @@ _ACEOF echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define HAVE_ZONE_STAT_ITEM_FIA 1 +#define HAVE_ZONE_STAT_ITEM_NR_INACTIVE 1 _ACEOF @@ -21214,8 +21237,8 @@ fi - echo "$as_me:$LINENO: checking whether vfs_unlink() wants 2 args" >&5 -echo $ECHO_N "checking whether vfs_unlink() wants 2 args... $ECHO_C" >&6 + echo "$as_me:$LINENO: checking whether page state NR_INACTIVE_ANON is available" >&5 +echo $ECHO_N "checking whether page state NR_INACTIVE_ANON is available... $ECHO_C" >&6 cat >conftest.c <<_ACEOF @@ -21226,13 +21249,14 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #include + #include int main (void) { - vfs_unlink(NULL, NULL); + enum zone_stat_item zsi; + zsi = NR_INACTIVE_ANON; ; return 0; @@ -21259,7 +21283,7 @@ _ACEOF echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define HAVE_2ARGS_VFS_UNLINK 1 +#define HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON 1 _ACEOF @@ -21278,8 +21302,8 @@ fi - echo "$as_me:$LINENO: checking whether vfs_rename() wants 4 args" >&5 -echo $ECHO_N "checking whether vfs_rename() wants 4 args... $ECHO_C" >&6 + echo "$as_me:$LINENO: checking whether page state NR_INACTIVE_FILE is available" >&5 +echo $ECHO_N "checking whether page state NR_INACTIVE_FILE is available... $ECHO_C" >&6 cat >conftest.c <<_ACEOF @@ -21290,13 +21314,14 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #include + #include int main (void) { - vfs_rename(NULL, NULL, NULL, NULL); + enum zone_stat_item zsi; + zsi = NR_INACTIVE_FILE; ; return 0; @@ -21323,7 +21348,7 @@ _ACEOF echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define HAVE_4ARGS_VFS_RENAME 1 +#define HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE 1 _ACEOF @@ -21343,8 +21368,8 @@ fi - echo "$as_me:$LINENO: checking whether struct cred exists" >&5 -echo $ECHO_N "checking whether struct cred exists... $ECHO_C" >&6 + echo "$as_me:$LINENO: checking whether page state NR_ACTIVE is available" >&5 +echo $ECHO_N "checking whether page state NR_ACTIVE is available... $ECHO_C" >&6 cat >conftest.c <<_ACEOF @@ -21355,14 +21380,14 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #include + #include int main (void) { - struct cred *cr; - cr = NULL; + enum zone_stat_item zsi; + zsi = NR_ACTIVE; ; return 0; @@ -21389,7 +21414,7 @@ _ACEOF echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define HAVE_CRED_STRUCT 1 +#define HAVE_ZONE_STAT_ITEM_NR_ACTIVE 1 _ACEOF @@ -21408,136 +21433,578 @@ fi + echo "$as_me:$LINENO: checking whether page state NR_ACTIVE_ANON is available" >&5 +echo $ECHO_N "checking whether page state NR_ACTIVE_ANON is available... $ECHO_C" >&6 - echo "$as_me:$LINENO: checking whether symbol groups_search is exported" >&5 -echo $ECHO_N "checking whether symbol groups_search is exported... $ECHO_C" >&6 - grep -q -E '[[:space:]]groups_search[[:space:]]' \ - $LINUX_OBJ/Module*.symvers 2>/dev/null - rc=$? - if test $rc -ne 0; then - export=0 - for file in ; do - grep -q -E "EXPORT_SYMBOL.*(groups_search)" \ - "$LINUX_OBJ/$file" 2>/dev/null - rc=$? - if test $rc -eq 0; then - export=1 - break; - fi - done - if test $export -eq 0; then - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - else - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 +cat >conftest.c <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + + #include + +int +main (void) +{ + + enum zone_stat_item zsi; + zsi = NR_ACTIVE_ANON; + + ; + return 0; +} -cat >>confdefs.h <<\_ACEOF -#define HAVE_GROUPS_SEARCH 1 _ACEOF - fi - else + + rm -Rf build && mkdir -p build + echo "obj-m := conftest.o" >build/Makefile + if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define HAVE_GROUPS_SEARCH 1 +#define HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON 1 _ACEOF - fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - ;; - user) ;; - all) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 -# Check whether --with-linux or --without-linux was given. -if test "${with_linux+set}" = set; then - withval="$with_linux" - kernelsrc="$withval" -fi; +fi -# Check whether --with-linux-obj or --without-linux-obj was given. -if test "${with_linux_obj+set}" = set; then - withval="$with_linux_obj" - kernelbuild="$withval" -fi; + rm -Rf build - echo "$as_me:$LINENO: checking kernel source directory" >&5 -echo $ECHO_N "checking kernel source directory... $ECHO_C" >&6 - if test -z "$kernelsrc"; then - sourcelink=`ls -1d /usr/src/kernels/* /usr/src/linux-* \ - 2>/dev/null | grep -v obj | tail -1` - if test -e ${sourcelink}; then - kernelsrc=`readlink -f ${sourcelink}` - else - echo "$as_me:$LINENO: result: Not found" >&5 -echo "${ECHO_T}Not found" >&6 - { { echo "$as_me:$LINENO: error: - *** Please specify the location of the kernel source - *** with the '--with-linux=PATH' option" >&5 -echo "$as_me: error: - *** Please specify the location of the kernel source - *** with the '--with-linux=PATH' option" >&2;} - { (exit 1); exit 1; }; } - fi - else - if test "$kernelsrc" = "NONE"; then - kernsrcver=NONE - fi - fi - echo "$as_me:$LINENO: result: $kernelsrc" >&5 -echo "${ECHO_T}$kernelsrc" >&6 - echo "$as_me:$LINENO: checking kernel build directory" >&5 -echo $ECHO_N "checking kernel build directory... $ECHO_C" >&6 - if test -z "$kernelbuild"; then - if test -d ${kernelsrc}-obj/`arch`/`arch`; then - kernelbuild=${kernelsrc}-obj/`arch`/`arch` - elif test -d ${kernelsrc}-obj/`arch`/default; then - kernelbuild=${kernelsrc}-obj/`arch`/default - elif test -d `dirname ${kernelsrc}`/build-`arch`; then - kernelbuild=`dirname ${kernelsrc}`/build-`arch` - else - kernelbuild=${kernelsrc} - fi - fi - echo "$as_me:$LINENO: result: $kernelbuild" >&5 -echo "${ECHO_T}$kernelbuild" >&6 + echo "$as_me:$LINENO: checking whether page state NR_ACTIVE_FILE is available" >&5 +echo $ECHO_N "checking whether page state NR_ACTIVE_FILE is available... $ECHO_C" >&6 - echo "$as_me:$LINENO: checking kernel source version" >&5 -echo $ECHO_N "checking kernel source version... $ECHO_C" >&6 - if test -r $kernelbuild/include/linux/version.h && - fgrep -q UTS_RELEASE $kernelbuild/include/linux/version.h; then - kernsrcver=`(echo "#include "; - echo "kernsrcver=UTS_RELEASE") | - cpp -I $kernelbuild/include | - grep "^kernsrcver=" | cut -d \" -f 2` +cat >conftest.c <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ - elif test -r $kernelbuild/include/linux/utsrelease.h && - fgrep -q UTS_RELEASE $kernelbuild/include/linux/utsrelease.h; then - kernsrcver=`(echo "#include "; - echo "kernsrcver=UTS_RELEASE") | - cpp -I $kernelbuild/include | - grep "^kernsrcver=" | cut -d \" -f 2` - fi + #include - if test -z "$kernsrcver"; then - echo "$as_me:$LINENO: result: Not found" >&5 -echo "${ECHO_T}Not found" >&6 - { { echo "$as_me:$LINENO: error: - *** Cannot determine the version of the linux kernel source. - *** Please prepare the kernel before running this script" >&5 -echo "$as_me: error: - *** Cannot determine the version of the linux kernel source. - *** Please prepare the kernel before running this script" >&2;} +int +main (void) +{ + + enum zone_stat_item zsi; + zsi = NR_ACTIVE_FILE; + + ; + return 0; +} + +_ACEOF + + + rm -Rf build && mkdir -p build + echo "obj-m := conftest.o" >build/Makefile + if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE 1 +_ACEOF + + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + + + +fi + + rm -Rf build + + + + + echo "$as_me:$LINENO: checking whether symbol get_zone_counts is needed" >&5 +echo $ECHO_N "checking whether symbol get_zone_counts is needed... $ECHO_C" >&6 + + +cat >conftest.c <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + + +int +main (void) +{ + + #if !defined(HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES) + #error "global_page_state needs NR_FREE_PAGES" + #endif + + #if !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE) && \ + !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON) && \ + !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE) + #error "global_page_state needs NR_ACTIVE*" + #endif + + #if !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE) && \ + !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON) && \ + !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE) + #error "global_page_state needs NR_INACTIVE*" + #endif + + ; + return 0; +} + +_ACEOF + + + rm -Rf build && mkdir -p build + echo "obj-m := conftest.o" >build/Makefile + if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define NEED_GET_ZONE_COUNTS 1 +_ACEOF + + + echo "$as_me:$LINENO: checking whether symbol get_zone_counts is exported" >&5 +echo $ECHO_N "checking whether symbol get_zone_counts is exported... $ECHO_C" >&6 + grep -q -E '[[:space:]]get_zone_counts[[:space:]]' \ + $LINUX_OBJ/Module*.symvers 2>/dev/null + rc=$? + if test $rc -ne 0; then + export=0 + for file in ; do + grep -q -E "EXPORT_SYMBOL.*(get_zone_counts)" \ + "$LINUX_OBJ/$file" 2>/dev/null + rc=$? + if test $rc -eq 0; then + export=1 + break; + fi + done + if test $export -eq 0; then + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + + else + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GET_ZONE_COUNTS 1 +_ACEOF + + fi + else + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GET_ZONE_COUNTS 1 +_ACEOF + + fi + + + + +fi + + rm -Rf build + + + + echo "$as_me:$LINENO: checking whether vfs_unlink() wants 2 args" >&5 +echo $ECHO_N "checking whether vfs_unlink() wants 2 args... $ECHO_C" >&6 + + +cat >conftest.c <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + + #include + +int +main (void) +{ + + vfs_unlink(NULL, NULL); + + ; + return 0; +} + +_ACEOF + + + rm -Rf build && mkdir -p build + echo "obj-m := conftest.o" >build/Makefile + if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_2ARGS_VFS_UNLINK 1 +_ACEOF + + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + + + +fi + + rm -Rf build + + + + echo "$as_me:$LINENO: checking whether vfs_rename() wants 4 args" >&5 +echo $ECHO_N "checking whether vfs_rename() wants 4 args... $ECHO_C" >&6 + + +cat >conftest.c <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + + #include + +int +main (void) +{ + + vfs_rename(NULL, NULL, NULL, NULL); + + ; + return 0; +} + +_ACEOF + + + rm -Rf build && mkdir -p build + echo "obj-m := conftest.o" >build/Makefile + if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_4ARGS_VFS_RENAME 1 +_ACEOF + + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + + + +fi + + rm -Rf build + + + + + echo "$as_me:$LINENO: checking whether struct cred exists" >&5 +echo $ECHO_N "checking whether struct cred exists... $ECHO_C" >&6 + + +cat >conftest.c <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + + #include + +int +main (void) +{ + + struct cred *cr; + cr = NULL; + + ; + return 0; +} + +_ACEOF + + + rm -Rf build && mkdir -p build + echo "obj-m := conftest.o" >build/Makefile + if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_CRED_STRUCT 1 +_ACEOF + + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + + + +fi + + rm -Rf build + + + + + echo "$as_me:$LINENO: checking whether symbol groups_search is exported" >&5 +echo $ECHO_N "checking whether symbol groups_search is exported... $ECHO_C" >&6 + grep -q -E '[[:space:]]groups_search[[:space:]]' \ + $LINUX_OBJ/Module*.symvers 2>/dev/null + rc=$? + if test $rc -ne 0; then + export=0 + for file in ; do + grep -q -E "EXPORT_SYMBOL.*(groups_search)" \ + "$LINUX_OBJ/$file" 2>/dev/null + rc=$? + if test $rc -eq 0; then + export=1 + break; + fi + done + if test $export -eq 0; then + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + + else + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GROUPS_SEARCH 1 +_ACEOF + + fi + else + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GROUPS_SEARCH 1 +_ACEOF + + fi + + + ;; + user) ;; + all) + + +# Check whether --with-linux or --without-linux was given. +if test "${with_linux+set}" = set; then + withval="$with_linux" + kernelsrc="$withval" +fi; + + +# Check whether --with-linux-obj or --without-linux-obj was given. +if test "${with_linux_obj+set}" = set; then + withval="$with_linux_obj" + kernelbuild="$withval" +fi; + + echo "$as_me:$LINENO: checking kernel source directory" >&5 +echo $ECHO_N "checking kernel source directory... $ECHO_C" >&6 + if test -z "$kernelsrc"; then + sourcelink=`ls -1d /usr/src/kernels/* /usr/src/linux-* \ + 2>/dev/null | grep -v obj | tail -1` + + if test -e ${sourcelink}; then + kernelsrc=`readlink -f ${sourcelink}` + else + echo "$as_me:$LINENO: result: Not found" >&5 +echo "${ECHO_T}Not found" >&6 + { { echo "$as_me:$LINENO: error: + *** Please specify the location of the kernel source + *** with the '--with-linux=PATH' option" >&5 +echo "$as_me: error: + *** Please specify the location of the kernel source + *** with the '--with-linux=PATH' option" >&2;} + { (exit 1); exit 1; }; } + fi + else + if test "$kernelsrc" = "NONE"; then + kernsrcver=NONE + fi + fi + + echo "$as_me:$LINENO: result: $kernelsrc" >&5 +echo "${ECHO_T}$kernelsrc" >&6 + echo "$as_me:$LINENO: checking kernel build directory" >&5 +echo $ECHO_N "checking kernel build directory... $ECHO_C" >&6 + if test -z "$kernelbuild"; then + if test -d ${kernelsrc}-obj/`arch`/`arch`; then + kernelbuild=${kernelsrc}-obj/`arch`/`arch` + elif test -d ${kernelsrc}-obj/`arch`/default; then + kernelbuild=${kernelsrc}-obj/`arch`/default + elif test -d `dirname ${kernelsrc}`/build-`arch`; then + kernelbuild=`dirname ${kernelsrc}`/build-`arch` + else + kernelbuild=${kernelsrc} + fi + fi + echo "$as_me:$LINENO: result: $kernelbuild" >&5 +echo "${ECHO_T}$kernelbuild" >&6 + + echo "$as_me:$LINENO: checking kernel source version" >&5 +echo $ECHO_N "checking kernel source version... $ECHO_C" >&6 + if test -r $kernelbuild/include/linux/version.h && + fgrep -q UTS_RELEASE $kernelbuild/include/linux/version.h; then + + kernsrcver=`(echo "#include "; + echo "kernsrcver=UTS_RELEASE") | + cpp -I $kernelbuild/include | + grep "^kernsrcver=" | cut -d \" -f 2` + + elif test -r $kernelbuild/include/linux/utsrelease.h && + fgrep -q UTS_RELEASE $kernelbuild/include/linux/utsrelease.h; then + + kernsrcver=`(echo "#include "; + echo "kernsrcver=UTS_RELEASE") | + cpp -I $kernelbuild/include | + grep "^kernsrcver=" | cut -d \" -f 2` + fi + + if test -z "$kernsrcver"; then + echo "$as_me:$LINENO: result: Not found" >&5 +echo "${ECHO_T}Not found" >&6 + { { echo "$as_me:$LINENO: error: + *** Cannot determine the version of the linux kernel source. + *** Please prepare the kernel before running this script" >&5 +echo "$as_me: error: + *** Cannot determine the version of the linux kernel source. + *** Please prepare the kernel before running this script" >&2;} { (exit 1); exit 1; }; } fi @@ -22466,29 +22933,293 @@ echo $ECHO_N "checking whether symbol set_normalized_timespec is exported... $EC echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 - else - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_SET_NORMALIZED_TIMESPEC_EXPORT 1 +_ACEOF + + fi + else + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_SET_NORMALIZED_TIMESPEC_EXPORT 1 +_ACEOF + + fi + + + + echo "$as_me:$LINENO: checking whether set_normalized_timespec() is an inline" >&5 +echo $ECHO_N "checking whether set_normalized_timespec() is an inline... $ECHO_C" >&6 + + +cat >conftest.c <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + + #include + void set_normalized_timespec(struct timespec *ts, + time_t sec, long nsec) { } + +int +main (void) +{ + + ; + return 0; +} + +_ACEOF + + + rm -Rf build && mkdir -p build + echo "obj-m := conftest.o" >build/Makefile + if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_SET_NORMALIZED_TIMESPEC_INLINE 1 +_ACEOF + + + + +fi + + rm -Rf build + + + + + echo "$as_me:$LINENO: checking whether timespec_sub() is available" >&5 +echo $ECHO_N "checking whether timespec_sub() is available... $ECHO_C" >&6 + + +cat >conftest.c <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + + #include + +int +main (void) +{ + + struct timespec a, b, c = { 0 }; + c = timespec_sub(a, b); + + ; + return 0; +} + +_ACEOF + + + rm -Rf build && mkdir -p build + echo "obj-m := conftest.o" >build/Makefile + if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_TIMESPEC_SUB 1 +_ACEOF + + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + + + +fi + + rm -Rf build + + + + + echo "$as_me:$LINENO: checking whether init_utsname() is available" >&5 +echo $ECHO_N "checking whether init_utsname() is available... $ECHO_C" >&6 + + +cat >conftest.c <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + + #include + +int +main (void) +{ + + struct new_utsname *a = init_utsname(); + + ; + return 0; +} + +_ACEOF + + + rm -Rf build && mkdir -p build + echo "obj-m := conftest.o" >build/Makefile + if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_INIT_UTSNAME 1 +_ACEOF + + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + + + +fi + + rm -Rf build + + + + + echo "$as_me:$LINENO: checking whether header linux/fdtable.h exists" >&5 +echo $ECHO_N "checking whether header linux/fdtable.h exists... $ECHO_C" >&6 + + +cat >conftest.c <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + + #include + +int +main (void) +{ + + return 0; + + ; + return 0; +} + +_ACEOF + + + rm -Rf build && mkdir -p build + echo "obj-m := conftest.o" >build/Makefile + if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cat >>confdefs.h <<\_ACEOF -#define HAVE_SET_NORMALIZED_TIMESPEC_EXPORT 1 +#define HAVE_FDTABLE_HEADER 1 _ACEOF - fi - else echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 -cat >>confdefs.h <<\_ACEOF -#define HAVE_SET_NORMALIZED_TIMESPEC_EXPORT 1 -_ACEOF - fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 - echo "$as_me:$LINENO: checking whether set_normalized_timespec() is an inline" >&5 -echo $ECHO_N "checking whether set_normalized_timespec() is an inline... $ECHO_C" >&6 + +fi + + rm -Rf build + + + + + + echo "$as_me:$LINENO: checking whether files_fdtable() is available" >&5 +echo $ECHO_N "checking whether files_fdtable() is available... $ECHO_C" >&6 cat >conftest.c <<_ACEOF @@ -22499,14 +23230,19 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #include - void set_normalized_timespec(struct timespec *ts, - time_t sec, long nsec) { } + #include + #include + #ifdef HAVE_FDTABLE_HEADER + #include + #endif int main (void) { + struct files_struct *files = current->files; + struct fdtable *fdt = files_fdtable(files); + ; return 0; } @@ -22528,21 +23264,21 @@ _ACEOF echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define HAVE_SET_NORMALIZED_TIMESPEC_INLINE 1 +#define HAVE_FILES_FDTABLE 1 _ACEOF +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + fi @@ -22552,8 +23288,8 @@ fi - echo "$as_me:$LINENO: checking whether timespec_sub() is available" >&5 -echo $ECHO_N "checking whether timespec_sub() is available... $ECHO_C" >&6 + echo "$as_me:$LINENO: checking whether header linux/uaccess.h exists" >&5 +echo $ECHO_N "checking whether header linux/uaccess.h exists... $ECHO_C" >&6 cat >conftest.c <<_ACEOF @@ -22564,14 +23300,13 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #include + #include int main (void) { - struct timespec a, b, c = { 0 }; - c = timespec_sub(a, b); + return 0; ; return 0; @@ -22594,13 +23329,14 @@ _ACEOF echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define HAVE_TIMESPEC_SUB 1 +#define HAVE_UACCESS_HEADER 1 _ACEOF + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else echo "$as_me: failed program was:" >&5 @@ -22611,6 +23347,7 @@ echo "${ECHO_T}no" >&6 + fi rm -Rf build @@ -22618,8 +23355,9 @@ fi - echo "$as_me:$LINENO: checking whether init_utsname() is available" >&5 -echo $ECHO_N "checking whether init_utsname() is available... $ECHO_C" >&6 + + echo "$as_me:$LINENO: checking whether kmalloc_node() is available" >&5 +echo $ECHO_N "checking whether kmalloc_node() is available... $ECHO_C" >&6 cat >conftest.c <<_ACEOF @@ -22630,13 +23368,13 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #include + #include int main (void) { - struct new_utsname *a = init_utsname(); + void *a = kmalloc_node(1, GFP_KERNEL, 0); ; return 0; @@ -22663,7 +23401,7 @@ _ACEOF echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define HAVE_INIT_UTSNAME 1 +#define HAVE_KMALLOC_NODE 1 _ACEOF @@ -22683,8 +23421,49 @@ fi - echo "$as_me:$LINENO: checking whether header linux/fdtable.h exists" >&5 -echo $ECHO_N "checking whether header linux/fdtable.h exists... $ECHO_C" >&6 + echo "$as_me:$LINENO: checking whether symbol monotonic_clock is exported" >&5 +echo $ECHO_N "checking whether symbol monotonic_clock is exported... $ECHO_C" >&6 + grep -q -E '[[:space:]]monotonic_clock[[:space:]]' \ + $LINUX_OBJ/Module*.symvers 2>/dev/null + rc=$? + if test $rc -ne 0; then + export=0 + for file in ; do + grep -q -E "EXPORT_SYMBOL.*(monotonic_clock)" \ + "$LINUX_OBJ/$file" 2>/dev/null + rc=$? + if test $rc -eq 0; then + export=1 + break; + fi + done + if test $export -eq 0; then + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + + else + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MONOTONIC_CLOCK 1 +_ACEOF + + fi + else + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MONOTONIC_CLOCK 1 +_ACEOF + + fi + + + + echo "$as_me:$LINENO: checking whether struct inode has i_mutex" >&5 +echo $ECHO_N "checking whether struct inode has i_mutex... $ECHO_C" >&6 cat >conftest.c <<_ACEOF @@ -22695,13 +23474,15 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #include + #include + #include int main (void) { - return 0; + struct inode i; + mutex_init(&i.i_mutex); ; return 0; @@ -22724,14 +23505,13 @@ _ACEOF echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define HAVE_FDTABLE_HEADER 1 +#define HAVE_INODE_I_MUTEX 1 _ACEOF - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else echo "$as_me: failed program was:" >&5 @@ -22742,7 +23522,6 @@ echo "${ECHO_T}no" >&6 - fi rm -Rf build @@ -22750,9 +23529,8 @@ fi - - echo "$as_me:$LINENO: checking whether files_fdtable() is available" >&5 -echo $ECHO_N "checking whether files_fdtable() is available... $ECHO_C" >&6 + echo "$as_me:$LINENO: checking whether mutex_lock_nested() is available" >&5 +echo $ECHO_N "checking whether mutex_lock_nested() is available... $ECHO_C" >&6 cat >conftest.c <<_ACEOF @@ -22763,18 +23541,15 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #include - #include - #ifdef HAVE_FDTABLE_HEADER - #include - #endif + #include int main (void) { - struct files_struct *files = current->files; - struct fdtable *fdt = files_fdtable(files); + struct mutex mutex; + mutex_init(&mutex); + mutex_lock_nested(&mutex, 0); ; return 0; @@ -22801,7 +23576,7 @@ _ACEOF echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define HAVE_FILES_FDTABLE 1 +#define HAVE_MUTEX_LOCK_NESTED 1 _ACEOF @@ -22821,8 +23596,90 @@ fi - echo "$as_me:$LINENO: checking whether header linux/uaccess.h exists" >&5 -echo $ECHO_N "checking whether header linux/uaccess.h exists... $ECHO_C" >&6 + echo "$as_me:$LINENO: checking whether symbol div64_64 is exported" >&5 +echo $ECHO_N "checking whether symbol div64_64 is exported... $ECHO_C" >&6 + grep -q -E '[[:space:]]div64_64[[:space:]]' \ + $LINUX_OBJ/Module*.symvers 2>/dev/null + rc=$? + if test $rc -ne 0; then + export=0 + for file in ; do + grep -q -E "EXPORT_SYMBOL.*(div64_64)" \ + "$LINUX_OBJ/$file" 2>/dev/null + rc=$? + if test $rc -eq 0; then + export=1 + break; + fi + done + if test $export -eq 0; then + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + + else + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DIV64_64 1 +_ACEOF + + fi + else + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DIV64_64 1 +_ACEOF + + fi + + + + echo "$as_me:$LINENO: checking whether symbol div64_u64 is exported" >&5 +echo $ECHO_N "checking whether symbol div64_u64 is exported... $ECHO_C" >&6 + grep -q -E '[[:space:]]div64_u64[[:space:]]' \ + $LINUX_OBJ/Module*.symvers 2>/dev/null + rc=$? + if test $rc -ne 0; then + export=0 + for file in ; do + grep -q -E "EXPORT_SYMBOL.*(div64_u64)" \ + "$LINUX_OBJ/$file" 2>/dev/null + rc=$? + if test $rc -eq 0; then + export=1 + break; + fi + done + if test $export -eq 0; then + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + + else + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DIV64_U64 1 +_ACEOF + + fi + else + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DIV64_U64 1 +_ACEOF + + fi + + + + echo "$as_me:$LINENO: checking whether on_each_cpu() wants 3 args" >&5 +echo $ECHO_N "checking whether on_each_cpu() wants 3 args... $ECHO_C" >&6 cat >conftest.c <<_ACEOF @@ -22833,13 +23690,13 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #include + #include int main (void) { - return 0; + on_each_cpu(NULL, NULL, 0); ; return 0; @@ -22862,14 +23719,13 @@ _ACEOF echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define HAVE_UACCESS_HEADER 1 +#define HAVE_3ARGS_ON_EACH_CPU 1 _ACEOF - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else echo "$as_me: failed program was:" >&5 @@ -22880,7 +23736,6 @@ echo "${ECHO_T}no" >&6 - fi rm -Rf build @@ -22888,81 +23743,156 @@ fi + echo "$as_me:$LINENO: checking whether symbol kallsyms_lookup_name is exported" >&5 +echo $ECHO_N "checking whether symbol kallsyms_lookup_name is exported... $ECHO_C" >&6 + grep -q -E '[[:space:]]kallsyms_lookup_name[[:space:]]' \ + $LINUX_OBJ/Module*.symvers 2>/dev/null + rc=$? + if test $rc -ne 0; then + export=0 + for file in ; do + grep -q -E "EXPORT_SYMBOL.*(kallsyms_lookup_name)" \ + "$LINUX_OBJ/$file" 2>/dev/null + rc=$? + if test $rc -eq 0; then + export=1 + break; + fi + done + if test $export -eq 0; then + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 - echo "$as_me:$LINENO: checking whether kmalloc_node() is available" >&5 -echo $ECHO_N "checking whether kmalloc_node() is available... $ECHO_C" >&6 + else + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +cat >>confdefs.h <<\_ACEOF +#define HAVE_KALLSYMS_LOOKUP_NAME 1 +_ACEOF -cat >conftest.c <<_ACEOF -/* confdefs.h. */ + fi + else + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_KALLSYMS_LOOKUP_NAME 1 _ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ + fi - #include -int -main (void) -{ - void *a = kmalloc_node(1, GFP_KERNEL, 0); + echo "$as_me:$LINENO: checking whether symbol get_vmalloc_info is exported" >&5 +echo $ECHO_N "checking whether symbol get_vmalloc_info is exported... $ECHO_C" >&6 + grep -q -E '[[:space:]]get_vmalloc_info[[:space:]]' \ + $LINUX_OBJ/Module*.symvers 2>/dev/null + rc=$? + if test $rc -ne 0; then + export=0 + for file in ; do + grep -q -E "EXPORT_SYMBOL.*(get_vmalloc_info)" \ + "$LINUX_OBJ/$file" 2>/dev/null + rc=$? + if test $rc -eq 0; then + export=1 + break; + fi + done + if test $export -eq 0; then + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 - ; - return 0; -} + else + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +cat >>confdefs.h <<\_ACEOF +#define HAVE_GET_VMALLOC_INFO 1 _ACEOF + fi + else + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GET_VMALLOC_INFO 1 +_ACEOF + + fi + - rm -Rf build && mkdir -p build - echo "obj-m := conftest.o" >build/Makefile - if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + echo "$as_me:$LINENO: checking whether symbol *_pgdat exist" >&5 +echo $ECHO_N "checking whether symbol *_pgdat exist... $ECHO_C" >&6 + grep -q -E 'first_online_pgdat' $LINUX/include/linux/mmzone.h 2>/dev/null + rc=$? + if test $rc -eq 0; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define HAVE_KMALLOC_NODE 1 +#define HAVE_PGDAT_HELPERS 1 _ACEOF + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - echo "$as_me:$LINENO: result: no" >&5 + echo "$as_me:$LINENO: checking whether symbol first_online_pgdat is exported" >&5 +echo $ECHO_N "checking whether symbol first_online_pgdat is exported... $ECHO_C" >&6 + grep -q -E '[[:space:]]first_online_pgdat[[:space:]]' \ + $LINUX_OBJ/Module*.symvers 2>/dev/null + rc=$? + if test $rc -ne 0; then + export=0 + for file in ; do + grep -q -E "EXPORT_SYMBOL.*(first_online_pgdat)" \ + "$LINUX_OBJ/$file" 2>/dev/null + rc=$? + if test $rc -eq 0; then + export=1 + break; + fi + done + if test $export -eq 0; then + echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 + else + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +cat >>confdefs.h <<\_ACEOF +#define HAVE_FIRST_ONLINE_PGDAT 1 +_ACEOF -fi + fi + else + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 - rm -Rf build +cat >>confdefs.h <<\_ACEOF +#define HAVE_FIRST_ONLINE_PGDAT 1 +_ACEOF + fi - echo "$as_me:$LINENO: checking whether symbol monotonic_clock is exported" >&5 -echo $ECHO_N "checking whether symbol monotonic_clock is exported... $ECHO_C" >&6 - grep -q -E '[[:space:]]monotonic_clock[[:space:]]' \ + echo "$as_me:$LINENO: checking whether symbol next_online_pgdat is exported" >&5 +echo $ECHO_N "checking whether symbol next_online_pgdat is exported... $ECHO_C" >&6 + grep -q -E '[[:space:]]next_online_pgdat[[:space:]]' \ $LINUX_OBJ/Module*.symvers 2>/dev/null rc=$? if test $rc -ne 0; then export=0 for file in ; do - grep -q -E "EXPORT_SYMBOL.*(monotonic_clock)" \ + grep -q -E "EXPORT_SYMBOL.*(next_online_pgdat)" \ "$LINUX_OBJ/$file" 2>/dev/null rc=$? if test $rc -eq 0; then @@ -22979,7 +23909,7 @@ echo "${ECHO_T}no" >&6 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define HAVE_MONOTONIC_CLOCK 1 +#define HAVE_NEXT_ONLINE_PGDAT 1 _ACEOF fi @@ -22988,15 +23918,97 @@ _ACEOF echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define HAVE_MONOTONIC_CLOCK 1 +#define HAVE_NEXT_ONLINE_PGDAT 1 _ACEOF fi - echo "$as_me:$LINENO: checking whether struct inode has i_mutex" >&5 -echo $ECHO_N "checking whether struct inode has i_mutex... $ECHO_C" >&6 + echo "$as_me:$LINENO: checking whether symbol next_zone is exported" >&5 +echo $ECHO_N "checking whether symbol next_zone is exported... $ECHO_C" >&6 + grep -q -E '[[:space:]]next_zone[[:space:]]' \ + $LINUX_OBJ/Module*.symvers 2>/dev/null + rc=$? + if test $rc -ne 0; then + export=0 + for file in ; do + grep -q -E "EXPORT_SYMBOL.*(next_zone)" \ + "$LINUX_OBJ/$file" 2>/dev/null + rc=$? + if test $rc -eq 0; then + export=1 + break; + fi + done + if test $export -eq 0; then + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + + else + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_NEXT_ZONE 1 +_ACEOF + + fi + else + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_NEXT_ZONE 1 +_ACEOF + + fi + + + + echo "$as_me:$LINENO: checking whether symbol pgdat_list is exported" >&5 +echo $ECHO_N "checking whether symbol pgdat_list is exported... $ECHO_C" >&6 + grep -q -E '[[:space:]]pgdat_list[[:space:]]' \ + $LINUX_OBJ/Module*.symvers 2>/dev/null + rc=$? + if test $rc -ne 0; then + export=0 + for file in ; do + grep -q -E "EXPORT_SYMBOL.*(pgdat_list)" \ + "$LINUX_OBJ/$file" 2>/dev/null + rc=$? + if test $rc -eq 0; then + export=1 + break; + fi + done + if test $export -eq 0; then + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + + else + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_PGDAT_LIST 1 +_ACEOF + + fi + else + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_PGDAT_LIST 1 +_ACEOF + + fi + + + + echo "$as_me:$LINENO: checking whether global_page_state() is available" >&5 +echo $ECHO_N "checking whether global_page_state() is available... $ECHO_C" >&6 cat >conftest.c <<_ACEOF @@ -23007,15 +24019,14 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #include - #include + #include int main (void) { - struct inode i; - mutex_init(&i.i_mutex); + unsigned long state; + state = global_page_state(0); ; return 0; @@ -23042,7 +24053,7 @@ _ACEOF echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define HAVE_INODE_I_MUTEX 1 +#define HAVE_GLOBAL_PAGE_STATE 1 _ACEOF @@ -23062,8 +24073,8 @@ fi - echo "$as_me:$LINENO: checking whether mutex_lock_nested() is available" >&5 -echo $ECHO_N "checking whether mutex_lock_nested() is available... $ECHO_C" >&6 + echo "$as_me:$LINENO: checking whether page state NR_FREE_PAGES is available" >&5 +echo $ECHO_N "checking whether page state NR_FREE_PAGES is available... $ECHO_C" >&6 cat >conftest.c <<_ACEOF @@ -23074,15 +24085,14 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #include + #include int main (void) { - struct mutex mutex; - mutex_init(&mutex); - mutex_lock_nested(&mutex, 0); + enum zone_stat_item zsi; + zsi = NR_FREE_PAGES; ; return 0; @@ -23109,7 +24119,7 @@ _ACEOF echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define HAVE_MUTEX_LOCK_NESTED 1 +#define HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES 1 _ACEOF @@ -23129,90 +24139,73 @@ fi - echo "$as_me:$LINENO: checking whether symbol div64_64 is exported" >&5 -echo $ECHO_N "checking whether symbol div64_64 is exported... $ECHO_C" >&6 - grep -q -E '[[:space:]]div64_64[[:space:]]' \ - $LINUX_OBJ/Module*.symvers 2>/dev/null - rc=$? - if test $rc -ne 0; then - export=0 - for file in ; do - grep -q -E "EXPORT_SYMBOL.*(div64_64)" \ - "$LINUX_OBJ/$file" 2>/dev/null - rc=$? - if test $rc -eq 0; then - export=1 - break; - fi - done - if test $export -eq 0; then - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + echo "$as_me:$LINENO: checking whether page state NR_INACTIVE is available" >&5 +echo $ECHO_N "checking whether page state NR_INACTIVE is available... $ECHO_C" >&6 - else - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -cat >>confdefs.h <<\_ACEOF -#define HAVE_DIV64_64 1 +cat >conftest.c <<_ACEOF +/* confdefs.h. */ _ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ - fi - else - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -cat >>confdefs.h <<\_ACEOF -#define HAVE_DIV64_64 1 -_ACEOF + #include - fi +int +main (void) +{ + enum zone_stat_item zsi; + zsi = NR_INACTIVE; + ; + return 0; +} - echo "$as_me:$LINENO: checking whether symbol div64_u64 is exported" >&5 -echo $ECHO_N "checking whether symbol div64_u64 is exported... $ECHO_C" >&6 - grep -q -E '[[:space:]]div64_u64[[:space:]]' \ - $LINUX_OBJ/Module*.symvers 2>/dev/null - rc=$? - if test $rc -ne 0; then - export=0 - for file in ; do - grep -q -E "EXPORT_SYMBOL.*(div64_u64)" \ - "$LINUX_OBJ/$file" 2>/dev/null - rc=$? - if test $rc -eq 0; then - export=1 - break; - fi - done - if test $export -eq 0; then - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 +_ACEOF - else - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -cat >>confdefs.h <<\_ACEOF -#define HAVE_DIV64_U64 1 -_ACEOF + rm -Rf build && mkdir -p build + echo "obj-m := conftest.o" >build/Makefile + if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then - fi - else echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define HAVE_DIV64_U64 1 +#define HAVE_ZONE_STAT_ITEM_NR_INACTIVE 1 _ACEOF - fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + + + +fi + + rm -Rf build - echo "$as_me:$LINENO: checking whether on_each_cpu() wants 3 args" >&5 -echo $ECHO_N "checking whether on_each_cpu() wants 3 args... $ECHO_C" >&6 + + echo "$as_me:$LINENO: checking whether page state NR_INACTIVE_ANON is available" >&5 +echo $ECHO_N "checking whether page state NR_INACTIVE_ANON is available... $ECHO_C" >&6 cat >conftest.c <<_ACEOF @@ -23223,13 +24216,14 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #include + #include int main (void) { - on_each_cpu(NULL, NULL, 0); + enum zone_stat_item zsi; + zsi = NR_INACTIVE_ANON; ; return 0; @@ -23256,7 +24250,7 @@ _ACEOF echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define HAVE_3ARGS_ON_EACH_CPU 1 +#define HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON 1 _ACEOF @@ -23275,314 +24269,204 @@ fi + echo "$as_me:$LINENO: checking whether page state NR_INACTIVE_FILE is available" >&5 +echo $ECHO_N "checking whether page state NR_INACTIVE_FILE is available... $ECHO_C" >&6 - echo "$as_me:$LINENO: checking whether symbol kallsyms_lookup_name is exported" >&5 -echo $ECHO_N "checking whether symbol kallsyms_lookup_name is exported... $ECHO_C" >&6 - grep -q -E '[[:space:]]kallsyms_lookup_name[[:space:]]' \ - $LINUX_OBJ/Module*.symvers 2>/dev/null - rc=$? - if test $rc -ne 0; then - export=0 - for file in ; do - grep -q -E "EXPORT_SYMBOL.*(kallsyms_lookup_name)" \ - "$LINUX_OBJ/$file" 2>/dev/null - rc=$? - if test $rc -eq 0; then - export=1 - break; - fi - done - if test $export -eq 0; then - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - - else - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -cat >>confdefs.h <<\_ACEOF -#define HAVE_KALLSYMS_LOOKUP_NAME 1 +cat >conftest.c <<_ACEOF +/* confdefs.h. */ _ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ - fi - else - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -cat >>confdefs.h <<\_ACEOF -#define HAVE_KALLSYMS_LOOKUP_NAME 1 -_ACEOF + #include - fi +int +main (void) +{ + enum zone_stat_item zsi; + zsi = NR_INACTIVE_FILE; + ; + return 0; +} - echo "$as_me:$LINENO: checking whether symbol get_vmalloc_info is exported" >&5 -echo $ECHO_N "checking whether symbol get_vmalloc_info is exported... $ECHO_C" >&6 - grep -q -E '[[:space:]]get_vmalloc_info[[:space:]]' \ - $LINUX_OBJ/Module*.symvers 2>/dev/null - rc=$? - if test $rc -ne 0; then - export=0 - for file in ; do - grep -q -E "EXPORT_SYMBOL.*(get_vmalloc_info)" \ - "$LINUX_OBJ/$file" 2>/dev/null - rc=$? - if test $rc -eq 0; then - export=1 - break; - fi - done - if test $export -eq 0; then - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 +_ACEOF - else - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -cat >>confdefs.h <<\_ACEOF -#define HAVE_GET_VMALLOC_INFO 1 -_ACEOF + rm -Rf build && mkdir -p build + echo "obj-m := conftest.o" >build/Makefile + if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then - fi - else echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define HAVE_GET_VMALLOC_INFO 1 +#define HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE 1 _ACEOF - fi - - - - echo "$as_me:$LINENO: checking whether symbol *_pgdat exist" >&5 -echo $ECHO_N "checking whether symbol *_pgdat exist... $ECHO_C" >&6 - grep -q -E 'first_online_pgdat' $LINUX/include/linux/mmzone.h 2>/dev/null - rc=$? - if test $rc -eq 0; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -cat >>confdefs.h <<\_ACEOF -#define HAVE_PGDAT_HELPERS 1 -_ACEOF +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 - fi - echo "$as_me:$LINENO: checking whether symbol first_online_pgdat is exported" >&5 -echo $ECHO_N "checking whether symbol first_online_pgdat is exported... $ECHO_C" >&6 - grep -q -E '[[:space:]]first_online_pgdat[[:space:]]' \ - $LINUX_OBJ/Module*.symvers 2>/dev/null - rc=$? - if test $rc -ne 0; then - export=0 - for file in ; do - grep -q -E "EXPORT_SYMBOL.*(first_online_pgdat)" \ - "$LINUX_OBJ/$file" 2>/dev/null - rc=$? - if test $rc -eq 0; then - export=1 - break; - fi - done - if test $export -eq 0; then - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - else - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 +fi + + rm -Rf build + -cat >>confdefs.h <<\_ACEOF -#define HAVE_FIRST_ONLINE_PGDAT 1 -_ACEOF - fi - else - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -cat >>confdefs.h <<\_ACEOF -#define HAVE_FIRST_ONLINE_PGDAT 1 + echo "$as_me:$LINENO: checking whether page state NR_ACTIVE is available" >&5 +echo $ECHO_N "checking whether page state NR_ACTIVE is available... $ECHO_C" >&6 + + +cat >conftest.c <<_ACEOF +/* confdefs.h. */ _ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ - fi + #include +int +main (void) +{ - echo "$as_me:$LINENO: checking whether symbol next_online_pgdat is exported" >&5 -echo $ECHO_N "checking whether symbol next_online_pgdat is exported... $ECHO_C" >&6 - grep -q -E '[[:space:]]next_online_pgdat[[:space:]]' \ - $LINUX_OBJ/Module*.symvers 2>/dev/null - rc=$? - if test $rc -ne 0; then - export=0 - for file in ; do - grep -q -E "EXPORT_SYMBOL.*(next_online_pgdat)" \ - "$LINUX_OBJ/$file" 2>/dev/null - rc=$? - if test $rc -eq 0; then - export=1 - break; - fi - done - if test $export -eq 0; then - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + enum zone_stat_item zsi; + zsi = NR_ACTIVE; - else - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 + ; + return 0; +} -cat >>confdefs.h <<\_ACEOF -#define HAVE_NEXT_ONLINE_PGDAT 1 _ACEOF - fi - else + + rm -Rf build && mkdir -p build + echo "obj-m := conftest.o" >build/Makefile + if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define HAVE_NEXT_ONLINE_PGDAT 1 +#define HAVE_ZONE_STAT_ITEM_NR_ACTIVE 1 _ACEOF - fi - +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - echo "$as_me:$LINENO: checking whether symbol next_zone is exported" >&5 -echo $ECHO_N "checking whether symbol next_zone is exported... $ECHO_C" >&6 - grep -q -E '[[:space:]]next_zone[[:space:]]' \ - $LINUX_OBJ/Module*.symvers 2>/dev/null - rc=$? - if test $rc -ne 0; then - export=0 - for file in ; do - grep -q -E "EXPORT_SYMBOL.*(next_zone)" \ - "$LINUX_OBJ/$file" 2>/dev/null - rc=$? - if test $rc -eq 0; then - export=1 - break; - fi - done - if test $export -eq 0; then - echo "$as_me:$LINENO: result: no" >&5 + echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 - else - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -cat >>confdefs.h <<\_ACEOF -#define HAVE_NEXT_ZONE 1 -_ACEOF - fi - else - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 +fi -cat >>confdefs.h <<\_ACEOF -#define HAVE_NEXT_ZONE 1 + rm -Rf build + + + + echo "$as_me:$LINENO: checking whether page state NR_ACTIVE_ANON is available" >&5 +echo $ECHO_N "checking whether page state NR_ACTIVE_ANON is available... $ECHO_C" >&6 + + +cat >conftest.c <<_ACEOF +/* confdefs.h. */ _ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ - fi + #include +int +main (void) +{ - echo "$as_me:$LINENO: checking whether symbol pgdat_list is exported" >&5 -echo $ECHO_N "checking whether symbol pgdat_list is exported... $ECHO_C" >&6 - grep -q -E '[[:space:]]pgdat_list[[:space:]]' \ - $LINUX_OBJ/Module*.symvers 2>/dev/null - rc=$? - if test $rc -ne 0; then - export=0 - for file in ; do - grep -q -E "EXPORT_SYMBOL.*(pgdat_list)" \ - "$LINUX_OBJ/$file" 2>/dev/null - rc=$? - if test $rc -eq 0; then - export=1 - break; - fi - done - if test $export -eq 0; then - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + enum zone_stat_item zsi; + zsi = NR_ACTIVE_ANON; - else - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 + ; + return 0; +} -cat >>confdefs.h <<\_ACEOF -#define HAVE_PGDAT_LIST 1 _ACEOF - fi - else + + rm -Rf build && mkdir -p build + echo "obj-m := conftest.o" >build/Makefile + if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define HAVE_PGDAT_LIST 1 +#define HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON 1 _ACEOF - fi - +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - echo "$as_me:$LINENO: checking whether symbol get_zone_counts is exported" >&5 -echo $ECHO_N "checking whether symbol get_zone_counts is exported... $ECHO_C" >&6 - grep -q -E '[[:space:]]get_zone_counts[[:space:]]' \ - $LINUX_OBJ/Module*.symvers 2>/dev/null - rc=$? - if test $rc -ne 0; then - export=0 - for file in ; do - grep -q -E "EXPORT_SYMBOL.*(get_zone_counts)" \ - "$LINUX_OBJ/$file" 2>/dev/null - rc=$? - if test $rc -eq 0; then - export=1 - break; - fi - done - if test $export -eq 0; then - echo "$as_me:$LINENO: result: no" >&5 + echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 - else - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -cat >>confdefs.h <<\_ACEOF -#define HAVE_GET_ZONE_COUNTS 1 -_ACEOF - fi - else - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -cat >>confdefs.h <<\_ACEOF -#define HAVE_GET_ZONE_COUNTS 1 -_ACEOF +fi - fi + rm -Rf build - echo "$as_me:$LINENO: checking whether global_page_state() is available" >&5 -echo $ECHO_N "checking whether global_page_state() is available... $ECHO_C" >&6 + echo "$as_me:$LINENO: checking whether page state NR_ACTIVE_FILE is available" >&5 +echo $ECHO_N "checking whether page state NR_ACTIVE_FILE is available... $ECHO_C" >&6 cat >conftest.c <<_ACEOF @@ -23593,14 +24477,14 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #include + #include int main (void) { - unsigned long state; - state = global_page_state(NR_FREE_PAGES); + enum zone_stat_item zsi; + zsi = NR_ACTIVE_FILE; ; return 0; @@ -23627,7 +24511,7 @@ _ACEOF echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define HAVE_GLOBAL_PAGE_STATE 1 +#define HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE 1 _ACEOF @@ -23647,8 +24531,8 @@ fi - echo "$as_me:$LINENO: checking whether free/inactive/active page state is available" >&5 -echo $ECHO_N "checking whether free/inactive/active page state is available... $ECHO_C" >&6 + echo "$as_me:$LINENO: checking whether symbol get_zone_counts is needed" >&5 +echo $ECHO_N "checking whether symbol get_zone_counts is needed... $ECHO_C" >&6 cat >conftest.c <<_ACEOF @@ -23659,16 +24543,26 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - #include int main (void) { - enum zone_stat_item i1, i2, i3; - i1 = NR_FREE_PAGES; - i2 = NR_INACTIVE; - i3 = NR_ACTIVE; + #if !defined(HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES) + #error "global_page_state needs NR_FREE_PAGES" + #endif + + #if !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE) && \ + !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON) && \ + !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE) + #error "global_page_state needs NR_ACTIVE*" + #endif + + #if !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE) && \ + !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON) && \ + !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE) + #error "global_page_state needs NR_INACTIVE*" + #endif ; return 0; @@ -23691,21 +24585,61 @@ _ACEOF echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF -#define HAVE_ZONE_STAT_ITEM_FIA 1 +#define NEED_GET_ZONE_COUNTS 1 _ACEOF -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - echo "$as_me:$LINENO: result: no" >&5 + echo "$as_me:$LINENO: checking whether symbol get_zone_counts is exported" >&5 +echo $ECHO_N "checking whether symbol get_zone_counts is exported... $ECHO_C" >&6 + grep -q -E '[[:space:]]get_zone_counts[[:space:]]' \ + $LINUX_OBJ/Module*.symvers 2>/dev/null + rc=$? + if test $rc -ne 0; then + export=0 + for file in ; do + grep -q -E "EXPORT_SYMBOL.*(get_zone_counts)" \ + "$LINUX_OBJ/$file" 2>/dev/null + rc=$? + if test $rc -eq 0; then + export=1 + break; + fi + done + if test $export -eq 0; then + echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 + else + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GET_ZONE_COUNTS 1 +_ACEOF + + fi + else + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GET_ZONE_COUNTS 1 +_ACEOF + + fi + + fi diff --git a/include/sys/vmsystm.h b/include/sys/vmsystm.h index 75365fde0..1c367d7cd 100644 --- a/include/sys/vmsystm.h +++ b/include/sys/vmsystm.h @@ -123,22 +123,21 @@ extern struct pglist_data *pgdat_list_addr; #endif /* HAVE_PGDAT_HELPERS */ /* Source linux/mm/vmstat.c */ -#ifndef HAVE_ZONE_STAT_ITEM_FIA -# ifndef HAVE_GET_ZONE_COUNTS +#if defined(NEED_GET_ZONE_COUNTS) && !defined(HAVE_GET_ZONE_COUNTS) typedef void (*get_zone_counts_t)(unsigned long *, unsigned long *, unsigned long *); extern get_zone_counts_t get_zone_counts_fn; # define get_zone_counts(a,i,f) get_zone_counts_fn(a,i,f) -# endif /* HAVE_GET_ZONE_COUNTS */ +#endif /* NEED_GET_ZONE_COUNTS && !HAVE_GET_ZONE_COUNTS */ -extern unsigned long spl_global_page_state(int); -/* Defines designed to simulate enum but large enough to ensure no overlap */ -# define NR_FREE_PAGES 0x8001 -# define NR_INACTIVE 0x8002 -# define NR_ACTIVE 0x8003 -#else -#define spl_global_page_state(item) global_page_state(item) -#endif /* HAVE_ZONE_STAT_ITEM_FIA */ +typedef enum spl_zone_stat_item { + SPL_NR_FREE_PAGES, + SPL_NR_INACTIVE, + SPL_NR_ACTIVE, + SPL_NR_ZONE_STAT_ITEMS +} spl_zone_stat_item_t; + +extern unsigned long spl_global_page_state(spl_zone_stat_item_t); #define xcopyin(from, to, size) copy_from_user(to, from, size) #define xcopyout(from, to, size) copy_to_user(to, from, size) diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c index 4edd3d7e1..b1124f706 100644 --- a/module/spl/spl-kmem.c +++ b/module/spl/spl-kmem.c @@ -109,49 +109,82 @@ EXPORT_SYMBOL(pgdat_list_addr); #endif /* HAVE_PGDAT_HELPERS */ -#ifndef HAVE_ZONE_STAT_ITEM_FIA +#ifdef NEED_GET_ZONE_COUNTS # ifndef HAVE_GET_ZONE_COUNTS get_zone_counts_t get_zone_counts_fn = SYMBOL_POISON; EXPORT_SYMBOL(get_zone_counts_fn); # endif /* HAVE_GET_ZONE_COUNTS */ unsigned long -spl_global_page_state(int item) +spl_global_page_state(spl_zone_stat_item_t item) { unsigned long active; unsigned long inactive; unsigned long free; - if (item == NR_FREE_PAGES) { - get_zone_counts(&active, &inactive, &free); - return free; + get_zone_counts(&active, &inactive, &free); + switch (item) { + case SPL_NR_FREE_PAGES: return free; + case SPL_NR_INACTIVE: return inactive; + case SPL_NR_ACTIVE: return active; + default: ASSERT(0); /* Unsupported */ } - if (item == NR_INACTIVE) { - get_zone_counts(&active, &inactive, &free); - return inactive; - } - - if (item == NR_ACTIVE) { - get_zone_counts(&active, &inactive, &free); - return active; + return 0; +} +#else +# ifdef HAVE_GLOBAL_PAGE_STATE +unsigned long +spl_global_page_state(spl_zone_stat_item_t item) +{ + unsigned long pages = 0; + + switch (item) { + case SPL_NR_FREE_PAGES: +# ifdef HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES + pages += global_page_state(NR_FREE_PAGES); +# endif + break; + case SPL_NR_INACTIVE: +# ifdef HAVE_ZONE_STAT_ITEM_NR_INACTIVE + pages += global_page_state(NR_INACTIVE); +# endif +# ifdef HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON + pages += global_page_state(NR_INACTIVE_ANON); +# endif +# ifdef HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE + pages += global_page_state(NR_INACTIVE_FILE); +# endif + break; + case SPL_NR_ACTIVE: +# ifdef HAVE_ZONE_STAT_ITEM_NR_ACTIVE + pages += global_page_state(NR_ACTIVE); +# endif +# ifdef HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON + pages += global_page_state(NR_ACTIVE_ANON); +# endif +# ifdef HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE + pages += global_page_state(NR_ACTIVE_FILE); +# endif + break; + default: + ASSERT(0); /* Unsupported */ } -# ifdef HAVE_GLOBAL_PAGE_STATE - return global_page_state((enum zone_stat_item)item); + return pages; +} # else - return 0; /* Unsupported */ +# error "Both global_page_state() and get_zone_counts() unavailable" # endif /* HAVE_GLOBAL_PAGE_STATE */ -} +#endif /* NEED_GET_ZONE_COUNTS */ EXPORT_SYMBOL(spl_global_page_state); -#endif /* HAVE_ZONE_STAT_ITEM_FIA */ pgcnt_t spl_kmem_availrmem(void) { /* The amount of easily available memory */ - return (spl_global_page_state(NR_FREE_PAGES) + - spl_global_page_state(NR_INACTIVE)); + return (spl_global_page_state(SPL_NR_FREE_PAGES) + + spl_global_page_state(SPL_NR_INACTIVE)); } EXPORT_SYMBOL(spl_kmem_availrmem); @@ -1856,16 +1889,14 @@ spl_kmem_init_kallsyms_lookup(void) # endif /* HAVE_PGDAT_LIST */ #endif /* HAVE_PGDAT_HELPERS */ -#ifndef HAVE_ZONE_STAT_ITEM_FIA -# ifndef HAVE_GET_ZONE_COUNTS +#if defined(NEED_GET_ZONE_COUNTS) && !defined(HAVE_GET_ZONE_COUNTS) get_zone_counts_fn = (get_zone_counts_t) spl_kallsyms_lookup_name("get_zone_counts"); if (!get_zone_counts_fn) { printk(KERN_ERR "Error: Unknown symbol get_zone_counts\n"); return -EFAULT; } -# endif /* HAVE_GET_ZONE_COUNTS */ -#endif /* HAVE_ZONE_STAT_ITEM_FIA */ +#endif /* NEED_GET_ZONE_COUNTS && !HAVE_GET_ZONE_COUNTS */ /* * It is now safe to initialize the global tunings which rely on diff --git a/module/splat/splat-kmem.c b/module/splat/splat-kmem.c index b021750ad..1007f7855 100644 --- a/module/splat/splat-kmem.c +++ b/module/splat/splat-kmem.c @@ -1045,16 +1045,17 @@ splat_kmem_test11(struct file *file, void *arg) static int splat_kmem_test12(struct file *file, void *arg) { - ssize_t alloc1, free1, total1; - ssize_t alloc2, free2, total2; + size_t alloc1, free1, total1; + size_t alloc2, free2, total2; int size = 8*1024*1024; void *ptr; alloc1 = vmem_size(NULL, VMEM_ALLOC); free1 = vmem_size(NULL, VMEM_FREE); total1 = vmem_size(NULL, VMEM_ALLOC | VMEM_FREE); - splat_vprint(file, SPLAT_KMEM_TEST12_NAME, "Vmem alloc=%d free=%d " - "total=%d\n", (int)alloc1, (int)free1, (int)total1); + splat_vprint(file, SPLAT_KMEM_TEST12_NAME, "Vmem alloc=%lu " + "free=%lu total=%lu\n", (unsigned long)alloc1, + (unsigned long)free1, (unsigned long)total1); splat_vprint(file, SPLAT_KMEM_TEST12_NAME, "Alloc %d bytes\n", size); ptr = vmem_alloc(size, KM_SLEEP); @@ -1067,42 +1068,44 @@ splat_kmem_test12(struct file *file, void *arg) alloc2 = vmem_size(NULL, VMEM_ALLOC); free2 = vmem_size(NULL, VMEM_FREE); total2 = vmem_size(NULL, VMEM_ALLOC | VMEM_FREE); - splat_vprint(file, SPLAT_KMEM_TEST12_NAME, "Vmem alloc=%d free=%d " - "total=%d\n", (int)alloc2, (int)free2, (int)total2); + splat_vprint(file, SPLAT_KMEM_TEST12_NAME, "Vmem alloc=%lu " + "free=%lu total=%lu\n", (unsigned long)alloc2, + (unsigned long)free2, (unsigned long)total2); splat_vprint(file, SPLAT_KMEM_TEST12_NAME, "Free %d bytes\n", size); vmem_free(ptr, size); if (alloc2 < (alloc1 + size - (size / 100)) || alloc2 > (alloc1 + size + (size / 100))) { - splat_vprint(file, SPLAT_KMEM_TEST12_NAME, - "Failed VMEM_ALLOC size: %d != %d+%d (+/- 1%%)\n", - (int)alloc2, (int)alloc1, size); + splat_vprint(file, SPLAT_KMEM_TEST12_NAME, "Failed " + "VMEM_ALLOC size: %lu != %lu+%d (+/- 1%%)\n", + (unsigned long)alloc2,(unsigned long)alloc1,size); return -ERANGE; } if (free2 < (free1 - size - (size / 100)) || free2 > (free1 - size + (size / 100))) { - splat_vprint(file, SPLAT_KMEM_TEST12_NAME, - "Failed VMEM_FREE size: %d != %d-%d (+/- 1%%)\n", - (int)free2, (int)free1, size); + splat_vprint(file, SPLAT_KMEM_TEST12_NAME, "Failed " + "VMEM_FREE size: %lu != %lu-%d (+/- 1%%)\n", + (unsigned long)free2, (unsigned long)free1, size); return -ERANGE; } if (total1 != total2) { - splat_vprint(file, SPLAT_KMEM_TEST12_NAME, - "Failed VMEM_ALLOC | VMEM_FREE not constant: " - "%d != %d\n", (int)total2, (int)total1); + splat_vprint(file, SPLAT_KMEM_TEST12_NAME, "Failed " + "VMEM_ALLOC | VMEM_FREE not constant: " + "%lu != %lu\n", (unsigned long)total2, + (unsigned long)total1); return -ERANGE; } splat_vprint(file, SPLAT_KMEM_TEST12_NAME, - "VMEM_ALLOC within tolerance: ~%d%% (%d/%d)\n", - (int)(((alloc1 + size) - alloc2) * 100 / size), - (int)((alloc1 + size) - alloc2), size); + "VMEM_ALLOC within tolerance: ~%ld%% (%ld/%d)\n", + (long)abs(alloc1 + (long)size - alloc2) * 100 / (long)size, + (long)abs(alloc1 + (long)size - alloc2), size); splat_vprint(file, SPLAT_KMEM_TEST12_NAME, - "VMEM_FREE within tolerance: ~%d%% (%d/%d)\n", - (int)(((free1 - size) - free2) * 100 / size), - (int)((free1 - size) - free2), size); + "VMEM_FREE within tolerance: ~%ld%% (%ld/%d)\n", + (long)abs((free1 - (long)size) - free2) * 100 / (long)size, + (long)abs((free1 - (long)size) - free2), size); return 0; } diff --git a/spl_config.h.in b/spl_config.h.in index 582a47603..c4097d80f 100644 --- a/spl_config.h.in +++ b/spl_config.h.in @@ -159,8 +159,29 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H -/* free/inactive/active page state is available */ -#undef HAVE_ZONE_STAT_ITEM_FIA +/* Page state NR_ACTIVE is available */ +#undef HAVE_ZONE_STAT_ITEM_NR_ACTIVE + +/* Page state NR_ACTIVE_ANON is available */ +#undef HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON + +/* Page state NR_ACTIVE_FILE is available */ +#undef HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE + +/* Page state NR_FREE_PAGES is available */ +#undef HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES + +/* Page state NR_INACTIVE is available */ +#undef HAVE_ZONE_STAT_ITEM_NR_INACTIVE + +/* Page state NR_INACTIVE_ANON is available */ +#undef HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON + +/* Page state NR_INACTIVE_FILE is available */ +#undef HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE + +/* get_zone_counts() is needed */ +#undef NEED_GET_ZONE_COUNTS /* Name of package */ #undef PACKAGE -- 2.40.0