* GPL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
/*
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.
if (strchr(file, '/'))
file = strrchr(file, '/') + 1;
+ tcd = cfs_trace_get_tcd();
+ /* cfs_trace_get_tcd() grabs a lock, which disables preemption and
+ * pins us to a particular CPU. This avoids an smp_processor_id()
+ * warning on Linux when debugging is enabled. */
cfs_set_ptldebug_header(&header, subsys, mask, line, CDEBUG_STACK());
- tcd = cfs_trace_get_tcd();
if (tcd == NULL) /* arch may not log in IRQ context */
goto console;
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);