From 022e9b2c03d7572cc1a33c5ac5ba8f16420ed856 Mon Sep 17 00:00:00 2001 From: rread Date: Thu, 29 Jul 2004 20:23:26 +0000 Subject: [PATCH] b=3554 Use cond_resched() ll_pgcache_remove_extent, and make sure we've got the definition for it. --- lnet/archdep.m4 | 16 +++++++++++++++- lustre/include/linux/lustre_compat25.h | 14 ++++++++------ lustre/llite/file.c | 2 +- lustre/portals/archdep.m4 | 16 +++++++++++++++- 4 files changed, 39 insertions(+), 9 deletions(-) diff --git a/lnet/archdep.m4 b/lnet/archdep.m4 index 37351ef..db70ec0 100644 --- a/lnet/archdep.m4 +++ b/lnet/archdep.m4 @@ -144,7 +144,7 @@ _ACEOF AC_DEFUN([LUSTRE_MODULE_COMPILE_IFELSE], [m4_ifvaln([$1], [LUSTRE_MODULE_CONFTEST([$1])])dnl rm -f kernel-tests/conftest.o kernel-tests/conftest.mod.c kernel-tests/conftest.ko -AS_IF([AC_TRY_COMMAND(cp conftest.c kernel-tests && make [$2] -f $PWD/kernel-tests/Makefile LUSTRE_LINUX_CONFIG=$LINUX_CONFIG -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX EXTRA_CFLAGS="$EXTRA_KCFLAGS" $ARCH_UM SUBDIRS=$PWD/kernel-tests) >/dev/null && AC_TRY_COMMAND([$3])], +AS_IF([AC_TRY_COMMAND(cp conftest.c kernel-tests && make [$2] -f $PWD/kernel-tests/Makefile LUSTRE_LINUX_CONFIG=$LINUX_CONFIG -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM SUBDIRS=$PWD/kernel-tests) >/dev/null && AC_TRY_COMMAND([$3])], [$4], [_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])dnl])dnl @@ -440,6 +440,20 @@ LUSTRE_MODULE_TRY_COMPILE( AC_MSG_RESULT([$LINUXRELEASE]) ]) +# ---------- 2.4.20 introduced cond_resched -------------- + +AC_MSG_CHECKING([if kernel offers cond_resched]) +LUSTRE_MODULE_TRY_COMPILE( + [ + #include + ],[ + cond_resched(); + ],[ + AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_COND_RESCHED, 1, [cond_resched found]) + ],[ + AC_MSG_RESULT([no]) + ]) # ---------- Red Hat 2.4.21 backports some more 2.5 bits -------- AC_MSG_CHECKING([if kernel defines PDE]) diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h index 13363bd..9b985d5 100644 --- a/lustre/include/linux/lustre_compat25.h +++ b/lustre/include/linux/lustre_compat25.h @@ -102,10 +102,6 @@ static inline int cleanup_group_info(void) #define smp_num_cpus NR_CPUS -#ifndef conditional_schedule -#define conditional_schedule() cond_resched() -#endif - #include #else /* 2.4.. */ @@ -183,8 +179,14 @@ static inline int cleanup_group_info(void) return 0; } -#ifndef conditional_schedule -#define conditional_schedule() if (unlikely(need_resched())) schedule() +#ifndef HAVE_COND_RESCHED +static inline void cond_resched(void) +{ + if (unlikely(need_resched())) { + set_curret_state(TASK_RUNNING); + schedule(); + } +} #endif /* to find proc_dir_entry from inode. 2.6 has native one -bzzz */ diff --git a/lustre/llite/file.c b/lustre/llite/file.c index bebd70e..659db37 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -413,7 +413,7 @@ void ll_pgcache_remove_extent(struct inode *inode, struct lov_stripe_md *lsm, break; } - conditional_schedule(); + cond_resched(); page = find_get_page(inode->i_mapping, i); if (page == NULL) diff --git a/lustre/portals/archdep.m4 b/lustre/portals/archdep.m4 index 37351ef..db70ec0 100644 --- a/lustre/portals/archdep.m4 +++ b/lustre/portals/archdep.m4 @@ -144,7 +144,7 @@ _ACEOF AC_DEFUN([LUSTRE_MODULE_COMPILE_IFELSE], [m4_ifvaln([$1], [LUSTRE_MODULE_CONFTEST([$1])])dnl rm -f kernel-tests/conftest.o kernel-tests/conftest.mod.c kernel-tests/conftest.ko -AS_IF([AC_TRY_COMMAND(cp conftest.c kernel-tests && make [$2] -f $PWD/kernel-tests/Makefile LUSTRE_LINUX_CONFIG=$LINUX_CONFIG -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX EXTRA_CFLAGS="$EXTRA_KCFLAGS" $ARCH_UM SUBDIRS=$PWD/kernel-tests) >/dev/null && AC_TRY_COMMAND([$3])], +AS_IF([AC_TRY_COMMAND(cp conftest.c kernel-tests && make [$2] -f $PWD/kernel-tests/Makefile LUSTRE_LINUX_CONFIG=$LINUX_CONFIG -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM SUBDIRS=$PWD/kernel-tests) >/dev/null && AC_TRY_COMMAND([$3])], [$4], [_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])dnl])dnl @@ -440,6 +440,20 @@ LUSTRE_MODULE_TRY_COMPILE( AC_MSG_RESULT([$LINUXRELEASE]) ]) +# ---------- 2.4.20 introduced cond_resched -------------- + +AC_MSG_CHECKING([if kernel offers cond_resched]) +LUSTRE_MODULE_TRY_COMPILE( + [ + #include + ],[ + cond_resched(); + ],[ + AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_COND_RESCHED, 1, [cond_resched found]) + ],[ + AC_MSG_RESULT([no]) + ]) # ---------- Red Hat 2.4.21 backports some more 2.5 bits -------- AC_MSG_CHECKING([if kernel defines PDE]) -- 1.8.3.1