From: Christoph Hellwig <hch@infradead.org>
To: Jeff Layton <jlayton@redhat.com>
Cc: linux-nfs@vger.kernel.org, Christoph Hellwig <hch@infradead.org>,
"J. Bruce Fields" <bfields@fieldses.org>
Subject: Re: [PATCH RFC 3/3] nfsd: convert DRC code to use list_lru
Date: Thu, 5 Dec 2013 05:41:29 -0800 [thread overview]
Message-ID: <20131205134129.GE3381@infradead.org> (raw)
In-Reply-To: <1386241253-5781-4-git-send-email-jlayton@redhat.com>
> static void
> -nfsd_reply_cache_free_locked(struct svc_cacherep *rp)
> +__nfsd_reply_cache_free_locked(struct svc_cacherep *rp)
> {
> if (rp->c_type == RC_REPLBUFF && rp->c_replvec.iov_base) {
> drc_mem_usage -= rp->c_replvec.iov_len;
> @@ -140,13 +141,26 @@ nfsd_reply_cache_free_locked(struct svc_cacherep *rp)
> }
> if (!hlist_unhashed(&rp->c_hash))
> hlist_del(&rp->c_hash);
> - list_del(&rp->c_lru);
> --num_drc_entries;
> drc_mem_usage -= sizeof(*rp);
> kmem_cache_free(drc_slab, rp);
I would be better to move the hash list deletion out of this and
keep this as a plain nfsd_reply_cache_free(). E.g. in the lookup
cache hit case we've never linked any item and would want this low-level
function.
> }
>
> static void
> +nfsd_reply_cache_free_locked(struct svc_cacherep *rp)
> +{
> + list_lru_del(&lru_head, &rp->c_lru);
> + __nfsd_reply_cache_free_locked(rp);
> +}
> +
> +static void
> +nfsd_reply_cache_free_isolate(struct svc_cacherep *rp)
> +{
> + list_del(&rp->c_lru);
> + __nfsd_reply_cache_free_locked(rp);
> +}
Should be merged into the only caller.
> +
> +static void
> nfsd_reply_cache_free(struct svc_cacherep *rp)
> {
> spin_lock(&cache_lock);
> @@ -156,50 +170,66 @@ nfsd_reply_cache_free(struct svc_cacherep *rp)
>
> +static enum lru_status
> +nfsd_purge_lru_entry(struct list_head *item, spinlock_t *lock, void *cb_arg)
> {
> - struct svc_cacherep *rp;
> + struct svc_cacherep *rp = list_entry(item, struct svc_cacherep, c_lru);
>
> + nfsd_reply_cache_free_locked(rp);
> + return LRU_REMOVED;
> +}
> +
> +void nfsd_reply_cache_shutdown(void)
> +{
> unregister_shrinker(&nfsd_reply_cache_shrinker);
> cancel_delayed_work_sync(&cache_cleaner);
>
> - while (!list_empty(&lru_head)) {
> - rp = list_entry(lru_head.next, struct svc_cacherep, c_lru);
> - nfsd_reply_cache_free_locked(rp);
> - }
> + /* In principle, nothing should be altering the list now, but... */
> + spin_lock(&cache_lock);
> + list_lru_walk(&lru_head, nfsd_purge_lru_entry, NULL, ULONG_MAX);
> + spin_unlock(&cache_lock);
This needs the version that does the list_del internally to, doesn't
it? I'd suggest to just use sd_purge_expired_entry with a forced
flag in the argument.
> + memset(&lru_head, 0, sizeof(lru_head));
don't think there's much of a point.
All together doesn't seem to helpful as long as the DRC keeps
it's own timing based purge and similar bits unfortunatel.
next prev parent reply other threads:[~2013-12-05 13:41 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-05 11:00 [PATCH RFC 0/3] nfsd: convert nfsd DRC code to use list_lru infrastructure Jeff Layton
2013-12-05 11:00 ` [PATCH RFC 1/3] nfsd: don't try to reuse an expired DRC entry off the list Jeff Layton
2013-12-05 13:29 ` Christoph Hellwig
2013-12-05 13:41 ` Jeff Layton
2013-12-05 15:50 ` J. Bruce Fields
2013-12-05 16:22 ` Jeff Layton
2013-12-05 11:00 ` [PATCH RFC 2/3] list_lru: add a new LRU_SKIP_REST lru_status value and handling Jeff Layton
2013-12-05 13:30 ` Christoph Hellwig
2013-12-05 13:36 ` Jeff Layton
2013-12-05 11:00 ` [PATCH RFC 3/3] nfsd: convert DRC code to use list_lru Jeff Layton
2013-12-05 13:41 ` Christoph Hellwig [this message]
2013-12-05 13:48 ` Jeff Layton
2013-12-05 15:58 ` J. Bruce Fields
2013-12-11 16:31 ` J. Bruce Fields
2013-12-05 13:27 ` [PATCH RFC 0/3] nfsd: convert nfsd DRC code to use list_lru infrastructure Christoph Hellwig
2013-12-05 13:37 ` Jeff Layton
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=20131205134129.GE3381@infradead.org \
--to=hch@infradead.org \
--cc=bfields@fieldses.org \
--cc=jlayton@redhat.com \
--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;
as well as URLs for NNTP newsgroup(s).