Whamcloud - gitweb
b=21556 release cpu if needed while removing extents
authorJohann Lombardi <johann@sun.com>
Fri, 4 Jun 2010 10:19:47 +0000 (12:19 +0200)
committerJohann Lombardi <johann@sun.com>
Fri, 4 Jun 2010 10:19:47 +0000 (12:19 +0200)
i=oleg
i=vitaly

cache_remove_extents_from_lock() can hog cpu for too long.
add a call to cond_resched().

lnet/include/libcfs/darwin/darwin-prim.h
lnet/include/libcfs/linux/linux-prim.h
lnet/include/libcfs/user-prim.h
lnet/include/libcfs/winnt/winnt-prim.h
lustre/ChangeLog
lustre/osc/cache.c

index 55ed1b3..ee14b84 100644 (file)
@@ -286,6 +286,11 @@ static inline int cfs_schedule_timeout(int state, int64_t timeout)
  * unefficient and can be harmful if we have many elements to process */
 #define cfs_cond_resched() cfs_schedule_timeout(CFS_TASK_INTERRUPTIBLE, 1)
 
+static inline int cfs_cond_resched_lock(cfs_spinlock_t *lock)
+{
+        return 0;
+}
+
 #define __wait_event(wq, condition)                            \
 do {                                                           \
        struct cfs_waitlink __wait;                             \
index 754e036..fe7c7ea 100644 (file)
@@ -159,15 +159,8 @@ typedef long                            cfs_task_state_t;
 #define cfs_schedule()                  schedule()
 #define cfs_kthread_run(fn, data, fmt, arg...) kthread_run(fn, data, fmt, ##arg)
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-static inline void cfs_cond_resched(void)
-{
-        if (current->need_resched)
-               schedule();
-}
-#else
 #define cfs_cond_resched()              cond_resched()
-#endif
+#define cfs_cond_resched_lock(lock)     cond_resched_lock(lock)
 
 /* Kernel thread */
 typedef int (*cfs_thread_t)(void *);
index dc679a7..21a91f3 100644 (file)
@@ -99,7 +99,8 @@ int64_t cfs_waitq_timedwait(struct cfs_waitlink *link, int state, int64_t timeou
                 cfs_waitlink_t    l;            \
                 cfs_waitq_timedwait(&l, s, t);  \
         } while (0)
-#define cfs_cond_resched() do {} while(0)
+#define cfs_cond_resched()       do {} while(0)
+#define cfs_cond_resched_lock(l) (0)
 
 #define CFS_TASK_INTERRUPTIBLE  (0)
 #define CFS_TASK_UNINT          (0)
index abcf379..e62662e 100644 (file)
@@ -549,6 +549,11 @@ static inline void cfs_cond_resched()
     schedule_timeout(1i64);
 }
 
+static inline int cfs_cond_resched_lock(cfs_spinlock_t *lock)
+{
+        return 0;
+}
+
 #define CFS_DECL_JOURNAL_DATA  
 #define CFS_PUSH_JOURNAL           do {;} while(0)
 #define CFS_POP_JOURNAL                    do {;} while(0)
index e92cc9e..60c1e53 100644 (file)
@@ -166,6 +166,11 @@ Description: exp->exp_nid_stats == NULL in filter_tally()
 Details    : fix race with per-nid stats by delaying procfs cleanup until
             exp_refcount == 0
 
+Severity   : normal
+Bugzilla   : 21556
+Description: extent lock cancellation on client can keep the cpu busy for too
+            long.
+
 -------------------------------------------------------------------------------
 
 2010-04-30 Oracle, Inc.
index ae1a547..7a5d6c7 100644 (file)
@@ -340,6 +340,9 @@ static int cache_remove_extents_from_lock(struct lustre_cache *cache,
 
         spin_lock(&lock->l_extents_list_lock);
         while (!list_empty(&lock->l_extents_list)) {
+                if (unlikely(cfs_cond_resched_lock(&lock->l_extents_list_lock)))
+                        continue;
+
                 extent = list_entry(lock->l_extents_list.next,
                                     struct osc_async_page, oap_page_list);