From 983884c805fd1c0ba9637fb86c7c3a1e65d42fcb Mon Sep 17 00:00:00 2001 From: adilger Date: Tue, 10 Jun 2003 08:58:55 +0000 Subject: [PATCH] Use GFP_NOFS in portals, so that we don't call into the filesystem to try and free memory when we are trying to send an RPC for a write (which is trying to free memory). With this change, we can now run dbench and iozone on a single UML again. Of importance is the addition of sk->allocation to socknal. --- lnet/include/linux/kp30.h | 2 +- lnet/include/lnet/lib-lnet.h | 16 ++++++++-------- lnet/include/lnet/lib-p30.h | 16 ++++++++-------- lnet/klnds/qswlnd/qswlnd.c | 2 +- lnet/klnds/socklnd/socklnd.c | 4 ++-- lnet/klnds/toelnd/toenal.c | 2 +- lustre/portals/include/linux/kp30.h | 2 +- lustre/portals/include/portals/lib-p30.h | 16 ++++++++-------- lustre/portals/knals/qswnal/qswnal.c | 2 +- lustre/portals/knals/socknal/socknal.c | 4 ++-- lustre/portals/knals/toenal/toenal.c | 2 +- 11 files changed, 34 insertions(+), 34 deletions(-) diff --git a/lnet/include/linux/kp30.h b/lnet/include/linux/kp30.h index 25637b3..6d7f3f3 100644 --- a/lnet/include/linux/kp30.h +++ b/lnet/include/linux/kp30.h @@ -267,7 +267,7 @@ do { \ if (s > PORTAL_VMALLOC_SIZE) \ (ptr) = vmalloc(s); \ else \ - (ptr) = kmalloc(s, GFP_KERNEL); \ + (ptr) = kmalloc(s, GFP_NOFS); \ if ((ptr) == NULL) \ CERROR("PORTALS: out of memory at %s:%d (tried to alloc" \ " '" #ptr "' = %ld)\n", __FILE__, __LINE__, s); \ diff --git a/lnet/include/lnet/lib-lnet.h b/lnet/include/lnet/lib-lnet.h index ca92e5f..b623b93 100644 --- a/lnet/include/lnet/lib-lnet.h +++ b/lnet/include/lnet/lib-lnet.h @@ -183,28 +183,28 @@ static inline lib_eq_t * lib_eq_alloc (nal_cb_t *nal) { /* NEVER called with statelock held */ - lib_eq_t *eq = kmem_cache_alloc(ptl_eq_slab, GFP_KERNEL); - + lib_eq_t *eq = kmem_cache_alloc(ptl_eq_slab, GFP_NOFS); + if (eq == NULL) return (NULL); - + atomic_inc (&eq_in_use_count); return (eq); } -static inline void +static inline void lib_eq_free (nal_cb_t *nal, lib_eq_t *eq) { /* ALWAYS called with statelock held */ atomic_dec (&eq_in_use_count); - kmem_cache_free(ptl_eq_slab, eq); + kmem_cache_free(ptl_eq_slab, eq); } static inline lib_md_t * lib_md_alloc (nal_cb_t *nal) { /* NEVER called with statelock held */ - lib_md_t *md = kmem_cache_alloc(ptl_md_slab, GFP_KERNEL); + lib_md_t *md = kmem_cache_alloc(ptl_md_slab, GFP_NOFS); if (md == NULL) return (NULL); @@ -225,11 +225,11 @@ static inline lib_me_t * lib_me_alloc (nal_cb_t *nal) { /* NEVER called with statelock held */ - lib_me_t *me = kmem_cache_alloc(ptl_me_slab, GFP_KERNEL); + lib_me_t *me = kmem_cache_alloc(ptl_me_slab, GFP_NOFS); if (me == NULL) return (NULL); - + atomic_inc (&me_in_use_count); return (me); } diff --git a/lnet/include/lnet/lib-p30.h b/lnet/include/lnet/lib-p30.h index ca92e5f..b623b93 100644 --- a/lnet/include/lnet/lib-p30.h +++ b/lnet/include/lnet/lib-p30.h @@ -183,28 +183,28 @@ static inline lib_eq_t * lib_eq_alloc (nal_cb_t *nal) { /* NEVER called with statelock held */ - lib_eq_t *eq = kmem_cache_alloc(ptl_eq_slab, GFP_KERNEL); - + lib_eq_t *eq = kmem_cache_alloc(ptl_eq_slab, GFP_NOFS); + if (eq == NULL) return (NULL); - + atomic_inc (&eq_in_use_count); return (eq); } -static inline void +static inline void lib_eq_free (nal_cb_t *nal, lib_eq_t *eq) { /* ALWAYS called with statelock held */ atomic_dec (&eq_in_use_count); - kmem_cache_free(ptl_eq_slab, eq); + kmem_cache_free(ptl_eq_slab, eq); } static inline lib_md_t * lib_md_alloc (nal_cb_t *nal) { /* NEVER called with statelock held */ - lib_md_t *md = kmem_cache_alloc(ptl_md_slab, GFP_KERNEL); + lib_md_t *md = kmem_cache_alloc(ptl_md_slab, GFP_NOFS); if (md == NULL) return (NULL); @@ -225,11 +225,11 @@ static inline lib_me_t * lib_me_alloc (nal_cb_t *nal) { /* NEVER called with statelock held */ - lib_me_t *me = kmem_cache_alloc(ptl_me_slab, GFP_KERNEL); + lib_me_t *me = kmem_cache_alloc(ptl_me_slab, GFP_NOFS); if (me == NULL) return (NULL); - + atomic_inc (&me_in_use_count); return (me); } diff --git a/lnet/klnds/qswlnd/qswlnd.c b/lnet/klnds/qswlnd/qswlnd.c index f13e811..1a8fb74 100644 --- a/lnet/klnds/qswlnd/qswlnd.c +++ b/lnet/klnds/qswlnd/qswlnd.c @@ -501,7 +501,7 @@ kqswnal_initialise (void) LASSERT (krx->krx_npages > 0); for (j = 0; j < krx->krx_npages; j++) { - krx->krx_pages[j] = alloc_page (GFP_KERNEL); + krx->krx_pages[j] = alloc_page(GFP_KERNEL); if (krx->krx_pages[j] == NULL) { kqswnal_finalise (); diff --git a/lnet/klnds/socklnd/socklnd.c b/lnet/klnds/socklnd/socklnd.c index 5bf61aa..91d971c 100644 --- a/lnet/klnds/socklnd/socklnd.c +++ b/lnet/klnds/socklnd/socklnd.c @@ -187,7 +187,7 @@ ksocknal_add_sock (ptl_nid_t nid, int fd, int bind_irq) if (!conn) GOTO(error, ret); - memset (conn, 0, sizeof (conn)); /* zero for consistency */ + sock->sk->allocation = GFP_NOFS; /* don't call info fs for alloc */ conn->ksnc_file = file; conn->ksnc_sock = sock; @@ -815,7 +815,7 @@ ksocknal_module_init (void) LASSERT (fmb->fmb_npages > 0); for (j = 0; j < fmb->fmb_npages; j++) { - fmb->fmb_pages[j] = alloc_page (GFP_KERNEL); + fmb->fmb_pages[j] = alloc_page(GFP_KERNEL); if (fmb->fmb_pages[j] == NULL) { ksocknal_module_fini (); diff --git a/lnet/klnds/toelnd/toenal.c b/lnet/klnds/toelnd/toenal.c index 178ea41..1f5dc38 100644 --- a/lnet/klnds/toelnd/toenal.c +++ b/lnet/klnds/toelnd/toenal.c @@ -522,7 +522,7 @@ ktoenal_module_init (void) LASSERT (fmb->fmb_npages > 0); for (j = 0; j < fmb->fmb_npages; j++) { - fmb->fmb_pages[j] = alloc_page (GFP_KERNEL); + fmb->fmb_pages[j] = alloc_page(GFP_KERNEL); if (fmb->fmb_pages[j] == NULL) { diff --git a/lustre/portals/include/linux/kp30.h b/lustre/portals/include/linux/kp30.h index 25637b3..6d7f3f3 100644 --- a/lustre/portals/include/linux/kp30.h +++ b/lustre/portals/include/linux/kp30.h @@ -267,7 +267,7 @@ do { \ if (s > PORTAL_VMALLOC_SIZE) \ (ptr) = vmalloc(s); \ else \ - (ptr) = kmalloc(s, GFP_KERNEL); \ + (ptr) = kmalloc(s, GFP_NOFS); \ if ((ptr) == NULL) \ CERROR("PORTALS: out of memory at %s:%d (tried to alloc" \ " '" #ptr "' = %ld)\n", __FILE__, __LINE__, s); \ diff --git a/lustre/portals/include/portals/lib-p30.h b/lustre/portals/include/portals/lib-p30.h index ca92e5f..b623b93 100644 --- a/lustre/portals/include/portals/lib-p30.h +++ b/lustre/portals/include/portals/lib-p30.h @@ -183,28 +183,28 @@ static inline lib_eq_t * lib_eq_alloc (nal_cb_t *nal) { /* NEVER called with statelock held */ - lib_eq_t *eq = kmem_cache_alloc(ptl_eq_slab, GFP_KERNEL); - + lib_eq_t *eq = kmem_cache_alloc(ptl_eq_slab, GFP_NOFS); + if (eq == NULL) return (NULL); - + atomic_inc (&eq_in_use_count); return (eq); } -static inline void +static inline void lib_eq_free (nal_cb_t *nal, lib_eq_t *eq) { /* ALWAYS called with statelock held */ atomic_dec (&eq_in_use_count); - kmem_cache_free(ptl_eq_slab, eq); + kmem_cache_free(ptl_eq_slab, eq); } static inline lib_md_t * lib_md_alloc (nal_cb_t *nal) { /* NEVER called with statelock held */ - lib_md_t *md = kmem_cache_alloc(ptl_md_slab, GFP_KERNEL); + lib_md_t *md = kmem_cache_alloc(ptl_md_slab, GFP_NOFS); if (md == NULL) return (NULL); @@ -225,11 +225,11 @@ static inline lib_me_t * lib_me_alloc (nal_cb_t *nal) { /* NEVER called with statelock held */ - lib_me_t *me = kmem_cache_alloc(ptl_me_slab, GFP_KERNEL); + lib_me_t *me = kmem_cache_alloc(ptl_me_slab, GFP_NOFS); if (me == NULL) return (NULL); - + atomic_inc (&me_in_use_count); return (me); } diff --git a/lustre/portals/knals/qswnal/qswnal.c b/lustre/portals/knals/qswnal/qswnal.c index f13e811..1a8fb74 100644 --- a/lustre/portals/knals/qswnal/qswnal.c +++ b/lustre/portals/knals/qswnal/qswnal.c @@ -501,7 +501,7 @@ kqswnal_initialise (void) LASSERT (krx->krx_npages > 0); for (j = 0; j < krx->krx_npages; j++) { - krx->krx_pages[j] = alloc_page (GFP_KERNEL); + krx->krx_pages[j] = alloc_page(GFP_KERNEL); if (krx->krx_pages[j] == NULL) { kqswnal_finalise (); diff --git a/lustre/portals/knals/socknal/socknal.c b/lustre/portals/knals/socknal/socknal.c index 5bf61aa..91d971c 100644 --- a/lustre/portals/knals/socknal/socknal.c +++ b/lustre/portals/knals/socknal/socknal.c @@ -187,7 +187,7 @@ ksocknal_add_sock (ptl_nid_t nid, int fd, int bind_irq) if (!conn) GOTO(error, ret); - memset (conn, 0, sizeof (conn)); /* zero for consistency */ + sock->sk->allocation = GFP_NOFS; /* don't call info fs for alloc */ conn->ksnc_file = file; conn->ksnc_sock = sock; @@ -815,7 +815,7 @@ ksocknal_module_init (void) LASSERT (fmb->fmb_npages > 0); for (j = 0; j < fmb->fmb_npages; j++) { - fmb->fmb_pages[j] = alloc_page (GFP_KERNEL); + fmb->fmb_pages[j] = alloc_page(GFP_KERNEL); if (fmb->fmb_pages[j] == NULL) { ksocknal_module_fini (); diff --git a/lustre/portals/knals/toenal/toenal.c b/lustre/portals/knals/toenal/toenal.c index 178ea41..1f5dc38 100644 --- a/lustre/portals/knals/toenal/toenal.c +++ b/lustre/portals/knals/toenal/toenal.c @@ -522,7 +522,7 @@ ktoenal_module_init (void) LASSERT (fmb->fmb_npages > 0); for (j = 0; j < fmb->fmb_npages; j++) { - fmb->fmb_pages[j] = alloc_page (GFP_KERNEL); + fmb->fmb_pages[j] = alloc_page(GFP_KERNEL); if (fmb->fmb_pages[j] == NULL) { -- 1.8.3.1