All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever III <chuck.lever@oracle.com>
To: Olga Kornievskaia <aglo@umich.edu>
Cc: Linux NFS Mailing List <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH v1 01/11] NFSD: Shrink size of struct nfsd4_copy_notify
Date: Mon, 25 Jul 2022 14:36:36 +0000	[thread overview]
Message-ID: <92DBE2E3-ACA3-4EBF-9975-E561696CF15F@oracle.com> (raw)
In-Reply-To: <CAN-5tyGJFpBum6ZtO=9r0o7yNf1tsgNSEZBPJWj_qJUyLNtBWQ@mail.gmail.com>



> On Jul 25, 2022, at 10:19 AM, Olga Kornievskaia <aglo@umich.edu> wrote:
> 
> Hi Chuck,
> 
> A general question: what's the rule for deciding whether to allocate
> statically or dynamically? I thought that "small" structures it's
> better to preallocate (statically) for performance reasons. Or is the
> idea here that copy_notify/copy are rare operations that instead they
> should be allocated dynamically and so that other operations doesn't
> consume more memory in nfsd4_op structure?

tl;dr: the latter. But it's not an issue of memory consumption, it's
that this whole struct is cleared with memset(0) for each incoming
RPC.

nfsd4_op is a union -- it takes the size of the largest args struct
in that union. Before copy offload was introduced, that was about
250 bytes. After, it is ~10x larger.

There are 8 nfsd4_op structs in an array in nfsd4_compoundargs.

The nfsd4_compoundargs structure is cleared by
svc_generic_init_request() before each NFSv4 RPC is executed.

So, in this case, the problem is 8 x 2KB = ~17KB to clear on
each RPC call for an operation that is quite infrequently
requested.

In NFSD, typically the execution context is amenable to GFP_KERNEL,
so it's generally OK to allocate dynamically for infrequently
requested operations.


--
Chuck Lever




  reply	other threads:[~2022-07-25 14:36 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-22 20:18 [PATCH v1 00/11] Put struct nfsd4_copy on a diet Chuck Lever
2022-07-22 20:19 ` [PATCH v1 01/11] NFSD: Shrink size of struct nfsd4_copy_notify Chuck Lever
2022-07-25 14:19   ` Olga Kornievskaia
2022-07-25 14:36     ` Chuck Lever III [this message]
2022-07-22 20:19 ` [PATCH v1 02/11] NFSD: Shrink size of struct nfsd4_copy Chuck Lever
2022-07-24  6:30   ` kernel test robot
2022-07-22 20:19 ` [PATCH v1 03/11] NFSD: Reorder the fields in struct nfsd4_op Chuck Lever
2022-07-22 20:19 ` [PATCH v1 04/11] NFSD: Make nfs4_put_copy() static Chuck Lever
2022-07-22 20:19 ` [PATCH v1 05/11] NFSD: Make boolean fields in struct nfsd4_copy into atomic bit flags Chuck Lever
2022-07-22 20:19 ` [PATCH v1 06/11] NFSD: Refactor nfsd4_cleanup_inter_ssc() (1/2) Chuck Lever
2022-07-22 20:19 ` [PATCH v1 07/11] NFSD: Refactor nfsd4_cleanup_inter_ssc() (2/2) Chuck Lever
2022-07-22 20:19 ` [PATCH v1 08/11] NFSD: Refactor nfsd4_do_copy() Chuck Lever
2022-07-22 20:19 ` [PATCH v1 09/11] NFSD: Remove kmalloc from nfsd4_do_async_copy() Chuck Lever
2022-07-22 20:19 ` [PATCH v1 10/11] NFSD: Add nfsd4_send_cb_offload() Chuck Lever
2022-07-22 20:20 ` [PATCH v1 11/11] NFSD: Move copy offload callback arguments into a separate structure Chuck Lever
2022-07-26 19:45 ` [PATCH v1 00/11] Put struct nfsd4_copy on a diet Olga Kornievskaia
2022-07-27 16:18   ` Olga Kornievskaia
2022-07-27 16:38     ` dai.ngo
2022-07-27 17:15     ` Chuck Lever III
2022-07-27 17:52       ` Olga Kornievskaia
2022-07-27 18:04         ` Chuck Lever III
2022-07-27 18:21           ` Olga Kornievskaia
2022-07-27 18:48             ` Olga Kornievskaia
2022-07-27 19:23               ` dai.ngo

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=92DBE2E3-ACA3-4EBF-9975-E561696CF15F@oracle.com \
    --to=chuck.lever@oracle.com \
    --cc=aglo@umich.edu \
    --cc=linux-nfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.