public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dai Ngo <dai.ngo@oracle.com>
To: chuck.lever@oracle.com, jlayton@kernel.org
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH v7 0/2] NFSD: memory shrinker for NFSv4 clients
Date: Wed, 14 Sep 2022 08:54:24 -0700	[thread overview]
Message-ID: <1663170866-21524-1-git-send-email-dai.ngo@oracle.com> (raw)

This patch series implements the memory shrinker for NFSv4 clients
to react to system low memory condition.

The first patch adds a counter to keep track of the number of
courtesy clients in the system.

The second patch implements the courtesy_client_reaper used to
expiring the courtesy clients.

By destroying the courtesy clients, all states associated with
these clients are also released.

v2:
. fix kernel test robot errors in nfsd.h when CONFIG_NFSD_V4 not defined.

v3:
. add mod_delayed_work in nfsd_courtesy_client_scan to kick start
  the laundromat.

v4:
. replace the use of xchg() with vanilla '=' in patch 1.

v5:
. rename nfsd_courtesy_client_count to nfsd_courtesy_clients
. add helper nfsd4_update_courtesy_client_count
. move nfsd_register_client_shrinker into nfsd4_init_leases_net
. move nfsd4_leases_net_shutdown from nfsd.h to nfs4state.c
. do away with shrinker 'scan' callback, just return SHRINK_STOP
. remove unused nfsd_client_shrinker_reapcount

v6:
. create courtesy_client_reaper and a separate delayed_work for it
  using the laundromat_wq. 
  I tried merging nfs4_get_courtesy_client_reaplist and
  nfs4_get_client_reaplist but it make the code looks ugly and
  hard to read so I leave them as separate for now.

v7:
. patch1: rename nfsd4_decr_courtesy_client_count to
  nfsd4_dec_courtesy_client_count
. patch 2: get rid of nfsd_client_shrinker_cb_count and do not
  reschedule courtesy_client_reaper
---

Dai Ngo (2):
      NFSD: keep track of the number of courtesy clients in the system
      NFSD: add shrinker to reap courtesy clients on low memory condition

 fs/nfsd/netns.h     |   4 ++
 fs/nfsd/nfs4state.c | 111 +++++++++++++++++++++++++++++++++++++++++++----
 fs/nfsd/nfsctl.c    |   6 ++-
 fs/nfsd/nfsd.h      |   7 ++-
 4 files changed, 115 insertions(+), 13 deletions(-)


             reply	other threads:[~2022-09-14 15:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-14 15:54 Dai Ngo [this message]
2022-09-14 15:54 ` [PATCH v7 1/2] NFSD: keep track of the number of courtesy clients in the system Dai Ngo
2022-09-14 15:54 ` [PATCH v7 2/2] NFSD: add shrinker to reap courtesy clients on low memory condition Dai Ngo
2022-09-14 18:32   ` Chuck Lever III
2022-09-14 18:37     ` 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=1663170866-21524-1-git-send-email-dai.ngo@oracle.com \
    --to=dai.ngo@oracle.com \
    --cc=chuck.lever@oracle.com \
    --cc=jlayton@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox