mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@clusterfs.com>
To: Denis Vlasenko <vda@port.imtp.ilyichevsk.odessa.ua>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: How to safely reduce stack usage in nfs code?
Date: Thu, 28 Oct 2004 18:15:24 -0600	[thread overview]
Message-ID: <20041029001524.GR1343@schnapps.adilger.int> (raw)
In-Reply-To: <200410290020.01400.vda@port.imtp.ilyichevsk.odessa.ua>

[-- Attachment #1: Type: text/plain, Size: 1527 bytes --]

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/


[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2004-10-29  1:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-28 21:20 Denis Vlasenko
2004-10-29  0:15 ` Andreas Dilger [this message]
2004-10-29  9:01 ` Arjan van de Ven
2004-10-29 14:20   ` Trond Myklebust
2004-10-29 21:59     ` [PATCH] reduce stack usage of NFS (was Re: How to safely reduce...) Denis Vlasenko
2004-10-30  3:01       ` Randy.Dunlap
2004-10-30  9:23         ` Denis Vlasenko
2004-11-01 20:57       ` Trond Myklebust

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041029001524.GR1343@schnapps.adilger.int \
    --to=adilger@clusterfs.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=trond.myklebust@fys.uio.no \
    --cc=vda@port.imtp.ilyichevsk.odessa.ua \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®