if (portal_cerror == 0) \
break; \
CHECK_STACK(CDEBUG_STACK); \
- if (!(mask) || ((mask) & (D_ERROR | D_EMERG)) || \
+ if (!(mask) || ((mask) & (D_ERROR | D_EMERG | D_WARNING)) || \
(portal_debug & (mask) && \
portal_subsystem_debug & DEBUG_SUBSYSTEM)) \
portals_debug_msg(DEBUG_SUBSYSTEM, mask, \
#define GFP_MEMALLOC 0
#endif
-#define PORTAL_ALLOC(ptr, size) \
+#define PORTAL_ALLOC_GFP(ptr, size, mask) \
do { \
LASSERT (!in_interrupt()); \
if ((size) > PORTAL_VMALLOC_SIZE) \
(ptr) = vmalloc(size); \
else \
- (ptr) = kmalloc((size), (GFP_KERNEL | GFP_MEMALLOC)); \
- if ((ptr) == NULL) \
+ (ptr) = kmalloc((size), (mask)); \
+ if ((ptr) == NULL) { \
CERROR("PORTALS: out of memory at %s:%d (tried to alloc '"\
#ptr "' = %d)\n", __FILE__, __LINE__, (int)(size));\
- else { \
+ CERROR("PORTALS: %d total bytes allocated by portals\n", \
+ atomic_read(&portal_kmemory)); \
+ } else { \
portal_kmem_inc((ptr), (size)); \
memset((ptr), 0, (size)); \
} \
(int)(size), (ptr), atomic_read (&portal_kmemory)); \
} while (0)
+#define PORTAL_ALLOC(ptr, size) \
+ PORTAL_ALLOC_GFP(ptr, size, (GFP_KERNEL | GFP_MEMALLOC))
+
+#define PORTAL_ALLOC_ATOMIC(ptr, size) \
+ PORTAL_ALLOC_GFP(ptr, size, (GFP_ATOMIC | GFP_MEMALLOC))
+
#define PORTAL_FREE(ptr, size) \
do { \
int s = (size); \
CERROR("PORTALS: out of memory at %s:%d (tried to alloc" \
" '" #ptr "' from slab '" #slab "')\n", __FILE__, \
__LINE__); \
+ CERROR("PORTALS: %d total bytes allocated by portals\n", \
+ atomic_read(&portal_kmemory)); \
} else { \
portal_kmem_inc((ptr), (size)); \
memset((ptr), 0, (size)); \
} \
- CDEBUG(D_MALLOC, "kmalloced '" #ptr "': %ld at %p (tot %d).\n", \
+ CDEBUG(D_MALLOC, "kmalloced '" #ptr "': %d at %p (tot %d).\n", \
(int)(size), (ptr), atomic_read(&portal_kmemory)); \
} while (0)
/******************************************************************************/
/* Light-weight trace
* Support for temporary event tracing with minimal Heisenberg effect. */
-#define LWT_SUPPORT 1
+#define LWT_SUPPORT 0
+
+#define LWT_MEMORY (64<<20)
+#define LWT_MAX_CPUS 4
typedef struct {
cycles_t lwte_when;
extern int lwt_lookup_string (int *size, char *knlptr,
char *usrptr, int usrsize);
extern int lwt_control (int enable, int clear);
-extern int lwt_snapshot (int *ncpu, int *total_size,
+extern int lwt_snapshot (cycles_t *now, int *ncpu, int *total_size,
void *user_ptr, int user_size);
/* Note that we _don't_ define LWT_EVENT at all if LWT_SUPPORT isn't set.
#endif /* __KERNEL__ */
#endif /* LWT_SUPPORT */
+struct portals_device_userstate
+{
+ int pdu_memhog_pages;
+ struct page *pdu_memhog_root_page;
+};
#include <linux/portals_lib.h>
#define IOC_PORTAL_LWT_CONTROL _IOWR('e', 39, long)
#define IOC_PORTAL_LWT_SNAPSHOT _IOWR('e', 40, long)
#define IOC_PORTAL_LWT_LOOKUP_STRING _IOWR('e', 41, long)
-#define IOC_PORTAL_MAX_NR 41
+#define IOC_PORTAL_MEMHOG _IOWR('e', 42, long)
+#define IOC_PORTAL_MAX_NR 42
enum {
QSWNAL = 1,