Whamcloud - gitweb
LU-2468 libcfs: quiet spurious debug message
authorAndreas Dilger <andreas.dilger@intel.com>
Tue, 19 Feb 2013 19:05:40 +0000 (12:05 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 18 Mar 2013 19:41:01 +0000 (15:41 -0400)
When cfs_trace_get_tage_try()->cfs_tage_alloc() is allocating a debug
buffer, since e2a2fab993d01597010cb2b44df44a522af0eec8 (b=21776) this
allocation is denied when the allocation is happening in a memory
freeing path.  This caused a spurious "cannot allocate a tage" message
on the console each time.  Quiet that message, since it is expected.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: Ic800c474dc33f62843b74e06d9ca642cad3ebbe5
Reviewed-on: http://review.whamcloud.com/5470
Tested-by: Hudson
Reviewed-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
libcfs/libcfs/tracefile.c

index f31e000..d455e42 100644 (file)
@@ -149,20 +149,21 @@ cfs_trace_get_tage_try(struct cfs_trace_cpu_data *tcd, unsigned long len)
         }
 
         if (tcd->tcd_cur_pages < tcd->tcd_max_pages) {
         }
 
         if (tcd->tcd_cur_pages < tcd->tcd_max_pages) {
-                if (tcd->tcd_cur_stock_pages > 0) {
-                        tage = cfs_tage_from_list(tcd->tcd_stock_pages.prev);
-                        -- tcd->tcd_cur_stock_pages;
-                        cfs_list_del_init(&tage->linkage);
-                } else {
-                        tage = cfs_tage_alloc(CFS_ALLOC_ATOMIC);
-                        if (tage == NULL) {
-                                if (printk_ratelimit())
-                                        printk(CFS_KERN_WARNING
-                                               "cannot allocate a tage (%ld)\n",
-                                       tcd->tcd_cur_pages);
-                                return NULL;
-                        }
-                }
+               if (tcd->tcd_cur_stock_pages > 0) {
+                       tage = cfs_tage_from_list(tcd->tcd_stock_pages.prev);
+                       --tcd->tcd_cur_stock_pages;
+                       cfs_list_del_init(&tage->linkage);
+               } else {
+                       tage = cfs_tage_alloc(CFS_ALLOC_ATOMIC);
+                       if (unlikely(tage == NULL)) {
+                               if ((!cfs_memory_pressure_get() ||
+                                    cfs_in_interrupt()) && printk_ratelimit())
+                                       printk(CFS_KERN_WARNING
+                                              "cannot allocate a tage (%ld)\n",
+                                              tcd->tcd_cur_pages);
+                               return NULL;
+                       }
+               }
 
                 tage->used = 0;
                 tage->cpu = cfs_smp_processor_id();
 
                 tage->used = 0;
                 tage->cpu = cfs_smp_processor_id();