lkml.org 
[lkml]   [2004]   [Oct]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: How to safely reduce stack usage in nfs code?
On Oct 29, 2004  00:20 +0300, Denis Vlasenko wrote:
> I've got one stack overflow sometime ago.
> Partially due to NFS stack usage.
>
> structs nfs_fh and nfs_fattr take together ~300 bytes
> and are one of the most frequently used:
>
> # cd fs/nfs; grep 'struct nfs_fh [a-z0-9_]*;' * ; grep 'struct nfs_fattr [a-z0-9_]*;' *
> callback.h: struct nfs_fh fh;
> callback.h: struct nfs_fh fh;
> dir.c: struct nfs_fh fhandle;
> dir.c: struct nfs_fh fhandle;
> dir.c: struct nfs_fh fhandle;
> dir.c: struct nfs_fh fhandle;
> dir.c: struct nfs_fh sym_fh;
> nfsroot.c: struct nfs_fh fh;
> dir.c: struct nfs_fattr fattr;
> dir.c: struct nfs_fattr fattr;
> dir.c: struct nfs_fattr fattr;
> dir.c: struct nfs_fattr fattr;
> dir.c: struct nfs_fattr fattr;
> dir.c: struct nfs_fattr sym_attr;
> inode.c: struct nfs_fattr fattr;
> inode.c: struct nfs_fattr fattr;
> inode.c: struct nfs_fattr fattr;
> nfs3proc.c: struct nfs_fattr res;
> nfs4proc.c: struct nfs_fattr fattr;
>
> I can convert these into kmalloc'ed variants but hesitate to do so
> because of possible 'need to kmalloc in order to free memory for kmalloc'
> deadlocks.

Make the thread kmalloc unless it has PF_MEMALLOC set, in which case it
could get the structs from a small pool of reserved ones.

Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://members.shaw.ca/adilger/ http://members.shaw.ca/golinux/

[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 14:07    [W:0.079 / U:0.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site