From: "Zhang, Qiang1" <qiang1.zhang@intel.com>
To: "paulmck@kernel.org" <paulmck@kernel.org>
Cc: "urezki@gmail.com" <urezki@gmail.com>,
"frederic@kernel.org" <frederic@kernel.org>,
"joel@joelfernandes.org" <joel@joelfernandes.org>,
"qiang.zhang1211@gmail.com" <qiang.zhang1211@gmail.com>,
"rcu@vger.kernel.org" <rcu@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCHi v4] rcu/kvfree: Prevents cache growing when the backoff_page_cache_fill is set
Date: Wed, 12 Apr 2023 01:14:36 +0000 [thread overview]
Message-ID: <PH0PR11MB5880BB47DCBDC36F3F432F91DA9B9@PH0PR11MB5880.namprd11.prod.outlook.com> (raw)
In-Reply-To: <16bb9c4c-e27b-4483-a1d4-05245b8b1a51@paulmck-laptop>
> Currently, in kfree_rcu_shrink_scan(), the drain_page_cache() is
> executed before kfree_rcu_monitor() to drain page cache, if the bnode
> structure's->gp_snap has done, the kvfree_rcu_bulk() will fill the
> page cache again in kfree_rcu_monitor(), this commit add a check
> for krcp structure's->backoff_page_cache_fill in put_cached_bnode(),
> if the krcp structure's->backoff_page_cache_fill is set, prevent page
> cache growing and start fill page from krcp->nr_bkv_objs, if the
> krcp->nr_bkv_objs is greater or equal to nr_pages, not alloc page,
> avoid unnecessary __get_free_page() calls.
>
> Signed-off-by: Zqiang <qiang1.zhang@intel.com>
> ---
> kernel/rcu/tree.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index 41daae3239b5..d5639025bd1a 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -2908,6 +2908,8 @@ static inline bool
> put_cached_bnode(struct kfree_rcu_cpu *krcp,
> struct kvfree_rcu_bulk_data *bnode)
> {
> + if (atomic_read(&krcp->backoff_page_cache_fill))
> + return false;
>
>This one is still missing the logic that allows that cache to hold
>one page during low memory? Or is that being handled somewhere else?
>
Sorry, please ignore this patch, I will resend as suggested by Ulad,
thanks for review😊.
>
> Thanx, Paul
>
> // Check the limit.
> if (krcp->nr_bkv_objs >= rcu_min_cached_objs)
> return false;
> @@ -3223,7 +3225,7 @@ static void fill_page_cache_func(struct work_struct *work)
> nr_pages = atomic_read(&krcp->backoff_page_cache_fill) ?
> 1 : rcu_min_cached_objs;
>
> - for (i = 0; i < nr_pages; i++) {
> + for (i = krcp->nr_bkv_objs; i < nr_pages; i++) {
> bnode = (struct kvfree_rcu_bulk_data *)
> __get_free_page(GFP_KERNEL | __GFP_NORETRY | __GFP_NOMEMALLOC | __GFP_NOWARN);
>
> --
> 2.32.0
>
prev parent reply other threads:[~2023-04-12 1:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-11 14:27 [PATCHi v4] rcu/kvfree: Prevents cache growing when the backoff_page_cache_fill is set Zqiang
2023-04-11 16:43 ` Paul E. McKenney
2023-04-12 1:14 ` Zhang, Qiang1 [this message]
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=PH0PR11MB5880BB47DCBDC36F3F432F91DA9B9@PH0PR11MB5880.namprd11.prod.outlook.com \
--to=qiang1.zhang@intel.com \
--cc=frederic@kernel.org \
--cc=joel@joelfernandes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=qiang.zhang1211@gmail.com \
--cc=rcu@vger.kernel.org \
--cc=urezki@gmail.com \
/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).