Whamcloud - gitweb
b=2230
authorzab <zab>
Wed, 10 Dec 2003 02:03:24 +0000 (02:03 +0000)
committerzab <zab>
Wed, 10 Dec 2003 02:03:24 +0000 (02:03 +0000)
Allocation failures during heavy bulk IO load were causing timeouts.  Using
GFP_NOFS throughout lustre, and in particular instead of 0 as sk->allocation,
is our most recent attempt to appease the VM.  Make lots of noise if you see
allocation failures or deadlocks involving threads waiting for memory.

lnet/include/linux/kp30.h
lnet/klnds/socklnd/socklnd_cb.c
lustre/include/liblustre.h
lustre/include/linux/obd_support.h
lustre/portals/include/linux/kp30.h
lustre/portals/knals/socknal/socknal_cb.c

index 3d60631..2cd7b06 100644 (file)
@@ -279,10 +279,6 @@ do {                                                                          \
 
 #define PORTAL_VMALLOC_SIZE        16384
 
-#ifndef GFP_MEMALLOC
-#define GFP_MEMALLOC 0
-#endif
-
 #define PORTAL_ALLOC_GFP(ptr, size, mask)                                 \
 do {                                                                      \
         LASSERT (!in_interrupt());                                        \
@@ -304,10 +300,10 @@ do {                                                                      \
 } while (0)
 
 #define PORTAL_ALLOC(ptr, size) \
-        PORTAL_ALLOC_GFP(ptr, size, (GFP_KERNEL | GFP_MEMALLOC))
+        PORTAL_ALLOC_GFP(ptr, size, GFP_NOFS)
 
 #define PORTAL_ALLOC_ATOMIC(ptr, size) \
-        PORTAL_ALLOC_GFP(ptr, size, (GFP_ATOMIC | GFP_MEMALLOC))
+        PORTAL_ALLOC_GFP(ptr, size, GFP_ATOMIC)
 
 #define PORTAL_FREE(ptr, size)                                          \
 do {                                                                    \
@@ -326,14 +322,10 @@ do {                                                                    \
                s, (ptr), atomic_read(&portal_kmemory));                 \
 } while (0)
 
-#ifndef SLAB_MEMALLOC
-#define SLAB_MEMALLOC 0
-#endif
-
 #define PORTAL_SLAB_ALLOC(ptr, slab, size)                                \
 do {                                                                      \
         LASSERT(!in_interrupt());                                         \
-        (ptr) = kmem_cache_alloc((slab), (SLAB_KERNEL | SLAB_MEMALLOC));  \
+        (ptr) = kmem_cache_alloc((slab), SLAB_NOFS);                      \
         if ((ptr) == NULL) {                                              \
                 CERROR("PORTALS: out of memory at %s:%d (tried to alloc"  \
                        " '" #ptr "' from slab '" #slab "')\n", __FILE__,  \
index 9e04712..64278c6 100644 (file)
@@ -1679,8 +1679,6 @@ int ksocknal_scheduler (void *arg)
         kportal_daemonize (name);
         kportal_blockallsigs ();
 
-        current->flags |= PF_MEMALLOC;
-
 #if (CONFIG_SMP && CPU_AFFINITY)
         if ((cpu_online_map & (1 << id)) != 0) {
 #if 1
@@ -2139,7 +2137,7 @@ ksocknal_setup_sock (struct socket *sock)
         int             option;
         struct linger   linger;
 
-        sock->sk->allocation = GFP_MEMALLOC;
+        sock->sk->allocation = GFP_NOFS;
 
         /* Ensure this socket aborts active sends immediately when we close
          * it. */
@@ -2424,8 +2422,6 @@ ksocknal_autoconnectd (void *arg)
         kportal_daemonize (name);
         kportal_blockallsigs ();
 
-        current->flags |= PF_MEMALLOC;
-
         spin_lock_irqsave (&ksocknal_data.ksnd_autoconnectd_lock, flags);
 
         while (!ksocknal_data.ksnd_shuttingdown) {
@@ -2557,8 +2553,6 @@ ksocknal_reaper (void *arg)
         INIT_LIST_HEAD(&enomem_conns);
         init_waitqueue_entry (&wait, current);
 
-        current->flags |= PF_MEMALLOC;
-
         spin_lock_irqsave (&ksocknal_data.ksnd_reaper_lock, flags);
 
         while (!ksocknal_data.ksnd_shuttingdown) {
index 770ccf7..872bc5b 100644 (file)
@@ -110,7 +110,7 @@ static inline void *kmalloc(int size, int prot)
 #define GFP_KERNEL 1
 #define GFP_HIGHUSER 1
 #define GFP_ATOMIC 1
-#define GFP_MEMALLOC 1
+#define GFP_NOFS 1
 #define IS_ERR(a) (((a) && abs((int)(a)) < 500) ? 1 : 0)
 #define PTR_ERR(a) ((int)(a))
 #define ERR_PTR(a) ((void*)(a))
index 71ff36b..9c0e65b 100644 (file)
@@ -211,10 +211,6 @@ static inline void OBD_FAIL_WRITE(int id, struct super_block *sb)
 # endif
 #endif  /* __KERNEL__ */
 
-#ifndef GFP_MEMALLOC
-#define GFP_MEMALLOC 0
-#endif
-
 extern atomic_t portal_kmemory;
 
 #define OBD_ALLOC_GFP(ptr, size, gfp_mask)                                    \
@@ -236,7 +232,7 @@ do {                                                                          \
 } while (0)
 
 #ifndef OBD_GFP_MASK
-# define OBD_GFP_MASK (GFP_KERNEL | GFP_MEMALLOC)
+# define OBD_GFP_MASK GFP_NOFS
 #endif
 
 #define OBD_ALLOC(ptr, size) OBD_ALLOC_GFP(ptr, size, OBD_GFP_MASK)
@@ -303,17 +299,13 @@ do {                                                                          \
 } while (0)
 #endif
 
-#ifndef SLAB_MEMALLOC
-#define SLAB_MEMALLOC 0
-#endif
-
 /* we memset() the slab object to 0 when allocation succeeds, so DO NOT
  * HAVE A CTOR THAT DOES ANYTHING.  its work will be cleared here.  we'd
  * love to assert on that, but slab.c keeps kmem_cache_s all to itself. */
 #define OBD_SLAB_ALLOC(ptr, slab, type, size)                                 \
 do {                                                                          \
         LASSERT(!in_interrupt());                                             \
-        (ptr) = kmem_cache_alloc(slab, (type | SLAB_MEMALLOC));               \
+        (ptr) = kmem_cache_alloc(slab, (type));                               \
         if ((ptr) == NULL) {                                                  \
                 CERROR("slab-alloc of '"#ptr"' (%d bytes) failed at %s:%d\n", \
                        (int)(size), __FILE__, __LINE__);                      \
index 3d60631..2cd7b06 100644 (file)
@@ -279,10 +279,6 @@ do {                                                                          \
 
 #define PORTAL_VMALLOC_SIZE        16384
 
-#ifndef GFP_MEMALLOC
-#define GFP_MEMALLOC 0
-#endif
-
 #define PORTAL_ALLOC_GFP(ptr, size, mask)                                 \
 do {                                                                      \
         LASSERT (!in_interrupt());                                        \
@@ -304,10 +300,10 @@ do {                                                                      \
 } while (0)
 
 #define PORTAL_ALLOC(ptr, size) \
-        PORTAL_ALLOC_GFP(ptr, size, (GFP_KERNEL | GFP_MEMALLOC))
+        PORTAL_ALLOC_GFP(ptr, size, GFP_NOFS)
 
 #define PORTAL_ALLOC_ATOMIC(ptr, size) \
-        PORTAL_ALLOC_GFP(ptr, size, (GFP_ATOMIC | GFP_MEMALLOC))
+        PORTAL_ALLOC_GFP(ptr, size, GFP_ATOMIC)
 
 #define PORTAL_FREE(ptr, size)                                          \
 do {                                                                    \
@@ -326,14 +322,10 @@ do {                                                                    \
                s, (ptr), atomic_read(&portal_kmemory));                 \
 } while (0)
 
-#ifndef SLAB_MEMALLOC
-#define SLAB_MEMALLOC 0
-#endif
-
 #define PORTAL_SLAB_ALLOC(ptr, slab, size)                                \
 do {                                                                      \
         LASSERT(!in_interrupt());                                         \
-        (ptr) = kmem_cache_alloc((slab), (SLAB_KERNEL | SLAB_MEMALLOC));  \
+        (ptr) = kmem_cache_alloc((slab), SLAB_NOFS);                      \
         if ((ptr) == NULL) {                                              \
                 CERROR("PORTALS: out of memory at %s:%d (tried to alloc"  \
                        " '" #ptr "' from slab '" #slab "')\n", __FILE__,  \
index 9e04712..64278c6 100644 (file)
@@ -1679,8 +1679,6 @@ int ksocknal_scheduler (void *arg)
         kportal_daemonize (name);
         kportal_blockallsigs ();
 
-        current->flags |= PF_MEMALLOC;
-
 #if (CONFIG_SMP && CPU_AFFINITY)
         if ((cpu_online_map & (1 << id)) != 0) {
 #if 1
@@ -2139,7 +2137,7 @@ ksocknal_setup_sock (struct socket *sock)
         int             option;
         struct linger   linger;
 
-        sock->sk->allocation = GFP_MEMALLOC;
+        sock->sk->allocation = GFP_NOFS;
 
         /* Ensure this socket aborts active sends immediately when we close
          * it. */
@@ -2424,8 +2422,6 @@ ksocknal_autoconnectd (void *arg)
         kportal_daemonize (name);
         kportal_blockallsigs ();
 
-        current->flags |= PF_MEMALLOC;
-
         spin_lock_irqsave (&ksocknal_data.ksnd_autoconnectd_lock, flags);
 
         while (!ksocknal_data.ksnd_shuttingdown) {
@@ -2557,8 +2553,6 @@ ksocknal_reaper (void *arg)
         INIT_LIST_HEAD(&enomem_conns);
         init_waitqueue_entry (&wait, current);
 
-        current->flags |= PF_MEMALLOC;
-
         spin_lock_irqsave (&ksocknal_data.ksnd_reaper_lock, flags);
 
         while (!ksocknal_data.ksnd_shuttingdown) {