Re: [PATCH] Fix large allocation in nfsd init

2005-01-29 Thread Anton Blanchard

Hi Neil,

> Given that the purpose of this order-5 allocation is to provide
> storage for 1024 "struct svc_cacherep" structs, it would seem that a
> better approach would be to just do 1024 kmallocs.
> 
> I'll try to knock a patch together in next week sometime.

That works for me.

Anton
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Fix large allocation in nfsd init

2005-01-29 Thread Anton Blanchard

Hi Neil,

 Given that the purpose of this order-5 allocation is to provide
 storage for 1024 struct svc_cacherep structs, it would seem that a
 better approach would be to just do 1024 kmallocs.
 
 I'll try to knock a patch together in next week sometime.

That works for me.

Anton
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Fix large allocation in nfsd init

2005-01-26 Thread Neil Brown
On Thursday January 27, [EMAIL PROTECTED] wrote:
> 
> Hi,
> 
> I just added an NFS mount to a ppc64 box that had been up for a while.
> This required inserting the nfsd module. Unfortunately it failed:  
> 
> modprobe: page allocation failure. order:5, mode:0xd0
> Trace:
> [c00ba0f8] alloc_pages_current+0xc0/0xe4
> [c00941fc] __get_free_pages+0x54/0x1e0
> [d046f7d8] nfsd_cache_init+0x54/0x1a4 [nfsd]
> [d04782cc] init_nfsd+0x30/0x2564 [nfsd]
> [c0084bec] sys_init_module+0x23c/0x5ac
> [c001045c] ret_from_syscall_1+0x0/0xa4
> nfsd: cannot allocate 98304 bytes for reply cache
> 
> An order 5 allocation. Replace it with a vmalloc.

Given that the purpose of this order-5 allocation is to provide
storage for 1024 "struct svc_cacherep" structs, it would seem that a
better approach would be to just do 1024 kmallocs.

I'll try to knock a patch together in next week sometime.

Thanks,

NeilBrown
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] Fix large allocation in nfsd init

2005-01-26 Thread Anton Blanchard

Hi,

I just added an NFS mount to a ppc64 box that had been up for a while.
This required inserting the nfsd module. Unfortunately it failed:  

modprobe: page allocation failure. order:5, mode:0xd0
Trace:
[c00ba0f8] alloc_pages_current+0xc0/0xe4
[c00941fc] __get_free_pages+0x54/0x1e0
[d046f7d8] nfsd_cache_init+0x54/0x1a4 [nfsd]
[d04782cc] init_nfsd+0x30/0x2564 [nfsd]
[c0084bec] sys_init_module+0x23c/0x5ac
[c001045c] ret_from_syscall_1+0x0/0xa4
nfsd: cannot allocate 98304 bytes for reply cache

An order 5 allocation. Replace it with a vmalloc.

Anton

Signed-off-by: Anton Blanchard <[EMAIL PROTECTED]>

diff -puN fs/nfsd/nfscache.c~fix_nfsd_allocation fs/nfsd/nfscache.c
--- foobar2/fs/nfsd/nfscache.c~fix_nfsd_allocation  2005-01-27 
13:56:14.248445552 +1100
+++ foobar2-anton/fs/nfsd/nfscache.c2005-01-27 14:22:52.764642869 +1100
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -56,14 +57,10 @@ nfsd_cache_init(void)
struct svc_cacherep *rp;
struct nfscache_head*rh;
size_t  i;
-   unsigned long   order;
-
 
i = CACHESIZE * sizeof (struct svc_cacherep);
-   for (order = 0; (PAGE_SIZE << order) < i; order++)
-   ;
-   nfscache = (struct svc_cacherep *)
-   __get_free_pages(GFP_KERNEL, order);
+
+   nfscache = vmalloc(i);
if (!nfscache) {
printk (KERN_ERR "nfsd: cannot allocate %Zd bytes for reply 
cache\n", i);
return;
@@ -73,7 +70,7 @@ nfsd_cache_init(void)
i = HASHSIZE * sizeof (struct nfscache_head);
hash_list = kmalloc (i, GFP_KERNEL);
if (!hash_list) {
-   free_pages ((unsigned long)nfscache, order);
+   vfree(nfscache);
nfscache = NULL;
printk (KERN_ERR "nfsd: cannot allocate %Zd bytes for hash 
list\n", i);
return;
@@ -102,8 +99,6 @@ void
 nfsd_cache_shutdown(void)
 {
struct svc_cacherep *rp;
-   size_t  i;
-   unsigned long   order;
 
for (rp = lru_head; rp; rp = rp->c_lru_next) {
if (rp->c_state == RC_DONE && rp->c_type == RC_REPLBUFF)
@@ -112,10 +107,7 @@ nfsd_cache_shutdown(void)
 
cache_disabled = 1;
 
-   i = CACHESIZE * sizeof (struct svc_cacherep);
-   for (order = 0; (PAGE_SIZE << order) < i; order++)
-   ;
-   free_pages ((unsigned long)nfscache, order);
+   vfree(nfscache);
nfscache = NULL;
kfree (hash_list);
hash_list = NULL;
_
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] Fix large allocation in nfsd init

2005-01-26 Thread Anton Blanchard

Hi,

I just added an NFS mount to a ppc64 box that had been up for a while.
This required inserting the nfsd module. Unfortunately it failed:  

modprobe: page allocation failure. order:5, mode:0xd0
Trace:
[c00ba0f8] alloc_pages_current+0xc0/0xe4
[c00941fc] __get_free_pages+0x54/0x1e0
[d046f7d8] nfsd_cache_init+0x54/0x1a4 [nfsd]
[d04782cc] init_nfsd+0x30/0x2564 [nfsd]
[c0084bec] sys_init_module+0x23c/0x5ac
[c001045c] ret_from_syscall_1+0x0/0xa4
nfsd: cannot allocate 98304 bytes for reply cache

An order 5 allocation. Replace it with a vmalloc.

Anton

Signed-off-by: Anton Blanchard [EMAIL PROTECTED]

diff -puN fs/nfsd/nfscache.c~fix_nfsd_allocation fs/nfsd/nfscache.c
--- foobar2/fs/nfsd/nfscache.c~fix_nfsd_allocation  2005-01-27 
13:56:14.248445552 +1100
+++ foobar2-anton/fs/nfsd/nfscache.c2005-01-27 14:22:52.764642869 +1100
@@ -15,6 +15,7 @@
 #include linux/slab.h
 #include linux/string.h
 #include linux/spinlock.h
+#include linux/vmalloc.h
 
 #include linux/sunrpc/svc.h
 #include linux/nfsd/nfsd.h
@@ -56,14 +57,10 @@ nfsd_cache_init(void)
struct svc_cacherep *rp;
struct nfscache_head*rh;
size_t  i;
-   unsigned long   order;
-
 
i = CACHESIZE * sizeof (struct svc_cacherep);
-   for (order = 0; (PAGE_SIZE  order)  i; order++)
-   ;
-   nfscache = (struct svc_cacherep *)
-   __get_free_pages(GFP_KERNEL, order);
+
+   nfscache = vmalloc(i);
if (!nfscache) {
printk (KERN_ERR nfsd: cannot allocate %Zd bytes for reply 
cache\n, i);
return;
@@ -73,7 +70,7 @@ nfsd_cache_init(void)
i = HASHSIZE * sizeof (struct nfscache_head);
hash_list = kmalloc (i, GFP_KERNEL);
if (!hash_list) {
-   free_pages ((unsigned long)nfscache, order);
+   vfree(nfscache);
nfscache = NULL;
printk (KERN_ERR nfsd: cannot allocate %Zd bytes for hash 
list\n, i);
return;
@@ -102,8 +99,6 @@ void
 nfsd_cache_shutdown(void)
 {
struct svc_cacherep *rp;
-   size_t  i;
-   unsigned long   order;
 
for (rp = lru_head; rp; rp = rp-c_lru_next) {
if (rp-c_state == RC_DONE  rp-c_type == RC_REPLBUFF)
@@ -112,10 +107,7 @@ nfsd_cache_shutdown(void)
 
cache_disabled = 1;
 
-   i = CACHESIZE * sizeof (struct svc_cacherep);
-   for (order = 0; (PAGE_SIZE  order)  i; order++)
-   ;
-   free_pages ((unsigned long)nfscache, order);
+   vfree(nfscache);
nfscache = NULL;
kfree (hash_list);
hash_list = NULL;
_
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Fix large allocation in nfsd init

2005-01-26 Thread Neil Brown
On Thursday January 27, [EMAIL PROTECTED] wrote:
 
 Hi,
 
 I just added an NFS mount to a ppc64 box that had been up for a while.
 This required inserting the nfsd module. Unfortunately it failed:  
 
 modprobe: page allocation failure. order:5, mode:0xd0
 Trace:
 [c00ba0f8] alloc_pages_current+0xc0/0xe4
 [c00941fc] __get_free_pages+0x54/0x1e0
 [d046f7d8] nfsd_cache_init+0x54/0x1a4 [nfsd]
 [d04782cc] init_nfsd+0x30/0x2564 [nfsd]
 [c0084bec] sys_init_module+0x23c/0x5ac
 [c001045c] ret_from_syscall_1+0x0/0xa4
 nfsd: cannot allocate 98304 bytes for reply cache
 
 An order 5 allocation. Replace it with a vmalloc.

Given that the purpose of this order-5 allocation is to provide
storage for 1024 struct svc_cacherep structs, it would seem that a
better approach would be to just do 1024 kmallocs.

I'll try to knock a patch together in next week sometime.

Thanks,

NeilBrown
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/