From: pschwan Date: Sat, 9 Nov 2002 20:39:12 +0000 (+0000) Subject: use vmalloc for OBD_ALLOCs above 16k, like we do in Portals X-Git-Tag: 0.5.17~38 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=3e793499b822a08fa1c00a7ebba1bca663476d5c;p=fs%2Flustre-release.git use vmalloc for OBD_ALLOCs above 16k, like we do in Portals --- diff --git a/lustre/include/linux/obd_support.h b/lustre/include/linux/obd_support.h index a6eb4c2..d18341f 100644 --- a/lustre/include/linux/obd_support.h +++ b/lustre/include/linux/obd_support.h @@ -150,10 +150,15 @@ static inline void OBD_FAIL_WRITE(int id, kdev_t dev) } } +#define OBD_VMALLOC_SIZE 16384 + #define OBD_ALLOC(ptr, size) \ do { \ long s = (size); \ - (ptr) = kmalloc(s, GFP_KERNEL); \ + if (s > OBD_VMALLOC_SIZE) \ + (ptr) = vmalloc(s); \ + else \ + (ptr) = kmalloc(s, GFP_KERNEL); \ if ((ptr) == NULL) { \ CERROR("kmalloc of '" #ptr "' (%ld bytes) failed " \ "at %s:%d\n", s, __FILE__, __LINE__); \ @@ -169,7 +174,10 @@ do { \ do { \ int s = (size); \ LASSERT(ptr); \ - kfree((ptr)); \ + if (s > OBD_VMALLOC_SIZE) \ + vfree(ptr); \ + else \ + kfree(ptr); \ obd_memory -= s; \ CDEBUG(D_MALLOC, "kfreed '" #ptr "': %d at %p (tot %ld).\n", \ s, (ptr), obd_memory); \