Whamcloud - gitweb
LU-502 don't allow to kill service threads by OOM killer.
[fs/lustre-release.git] / libcfs / libcfs / tracefile.c
index 0402dc2..d681fc3 100644 (file)
@@ -71,6 +71,10 @@ static struct cfs_trace_page *cfs_tage_alloc(int gfp)
         cfs_page_t            *page;
         struct cfs_trace_page *tage;
 
+        /* My caller is trying to free memory */
+        if (!cfs_in_interrupt() && cfs_memory_pressure_get())
+                return NULL;
+
         /*
          * Don't spam console with allocation failures: they will be reported
          * by upper layer anyway.
@@ -309,7 +313,7 @@ int libcfs_debug_vmsg2(cfs_debug_limit_state_t *cdls, int subsys, int mask,
 
                 max_nob = CFS_PAGE_SIZE - tage->used - known_size;
                 if (max_nob <= 0) {
-                        printk(CFS_KERN_EMERG "negative max_nob: %i\n",
+                        printk(CFS_KERN_EMERG "negative max_nob: %d\n",
                                max_nob);
                         mask |= D_ERROR;
                         cfs_trace_put_tcd(tcd);
@@ -1092,7 +1096,7 @@ int cfs_trace_start_thread(void)
         cfs_waitq_init(&tctl->tctl_waitq);
         cfs_atomic_set(&tctl->tctl_shutdown, 0);
 
-        if (cfs_kernel_thread(tracefiled, tctl, 0) < 0) {
+        if (cfs_create_thread(tracefiled, tctl, 0) < 0) {
                 rc = -ECHILD;
                 goto out;
         }