linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Linux NFS Mailing List <linux-nfs@vger.kernel.org>,
	Neil Brown <neilb@suse.de>, Chuck Lever <chuck.lever@oracle.com>
Subject: Re: nfsd: unable to allocate nfsd_file_hashtbl
Date: Thu, 24 Feb 2022 06:07:08 -0500	[thread overview]
Message-ID: <e3cdaeec85a6cfec980e87fc294327c0381c1778.camel@kernel.org> (raw)
In-Reply-To: <CAOQ4uxhYsci9-ADNTH6RZmnzBQoxy0ek4+Hgi9sK8HpF2ftrow@mail.gmail.com>

On Thu, 2022-02-24 at 12:13 +0200, Amir Goldstein wrote:
> Hi Jeff,
> 
> I got some reports from customers about failure to allocate the
> nfsd_file_hashtbl on nfs server restart on a long running system,
> probably due to memory fragmentation.
> 
> A search in Google for this error message yields several results of
> similar reports [1][2].
> 
> My question is, does nfsd_file_cache_init() have to be done on server
> startup?
> 
> Doesn't it make more sense to allocate all the memory pools and
> hash table on init_nfsd()?
> 
> Thanks,
> Amir.
> 
> [1] https://unix.stackexchange.com/questions/640534/nfs-cannot-allocate-memory
> [2] https://askubuntu.com/questions/1365821/nfs-crashing-on-ubuntu-server-20-04

That is a big allocation. On my box, nfsd_fcache_bucket is 80 bytes, so
we end up needing 80 contiguous pages to allocate the whole table. It
doesn't surprise me that it fails sometimes.

We could just allocate it on init_nfsd, but that happens when the module
is plugged in and we'll lose 80 pages when people plug it in (or build
it in) and don't actually use nfsd.

The other option might be to just use kvcalloc? It's not a frequent
allocation, so I don't think performance would be an issue. We had
similar reports several years ago with nfsd_reply_cache_init, and using
kvzalloc ended up taking care of it.

-- 
Jeff Layton <jlayton@kernel.org>

  reply	other threads:[~2022-02-24 11:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-24 10:13 nfsd: unable to allocate nfsd_file_hashtbl Amir Goldstein
2022-02-24 11:07 ` Jeff Layton [this message]
2022-02-24 15:14   ` Chuck Lever III
2022-02-24 15:53     ` Jeff Layton
2022-02-24 16:08       ` Amir Goldstein

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=e3cdaeec85a6cfec980e87fc294327c0381c1778.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=amir73il@gmail.com \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.de \
    /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;
as well as URLs for NNTP newsgroup(s).