From: Uladzislau Rezki <urezki@gmail.com>
To: "Zhang, Qiang" <Qiang.Zhang@windriver.com>
Cc: Uladzislau Rezki <urezki@gmail.com>,
"paulmck@kernel.org" <paulmck@kernel.org>,
"joel@joelfernandes.org" <joel@joelfernandes.org>,
"rcu@vger.kernel.org" <rcu@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: 回复: [PATCH v2] kvfree_rcu: Release page cache under memory pressure
Date: Sat, 30 Jan 2021 12:21:52 +0100 [thread overview]
Message-ID: <20210130112152.GA1977@pc636> (raw)
In-Reply-To: <BYAPR11MB2632B16DBD0A3EBEA5EA2FAFFFB89@BYAPR11MB2632.namprd11.prod.outlook.com>
On Sat, Jan 30, 2021 at 06:47:31AM +0000, Zhang, Qiang wrote:
>
>
> ________________________________________
> 发件人: Uladzislau Rezki <urezki@gmail.com>
> 发送时间: 2021年1月29日 22:19
> 收件人: Zhang, Qiang
> 抄送: urezki@gmail.com; paulmck@kernel.org; joel@joelfernandes.org; rcu@vger.kernel.org; linux-kernel@vger.kernel.org
> 主题: Re: [PATCH v2] kvfree_rcu: Release page cache under memory pressure
>
> [Please note: This e-mail is from an EXTERNAL e-mail address]
>
> On Fri, Jan 29, 2021 at 04:04:42PM +0800, qiang.zhang@windriver.com wrote:
> > From: Zqiang <qiang.zhang@windriver.com>
> >
> > Add free per-cpu existing krcp's page cache operation, when
> > the system is under memory pressure.
> >
> > Signed-off-by: Zqiang <qiang.zhang@windriver.com>
> > ---
> > kernel/rcu/tree.c | 25 +++++++++++++++++++++++++
> > 1 file changed, 25 insertions(+)
> >
> > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> > index c1ae1e52f638..ec098910d80b 100644
> > --- a/kernel/rcu/tree.c
> > +++ b/kernel/rcu/tree.c
> > @@ -3571,17 +3571,40 @@ void kvfree_call_rcu(struct rcu_head *head, rcu_callback_t func)
> > }
> > EXPORT_SYMBOL_GPL(kvfree_call_rcu);
> >
> > +static int free_krc_page_cache(struct kfree_rcu_cpu *krcp)
> > +{
> > + unsigned long flags;
> > + struct kvfree_rcu_bulk_data *bnode;
> > + int i;
> > +
> > + for (i = 0; i < rcu_min_cached_objs; i++) {
> > + raw_spin_lock_irqsave(&krcp->lock, flags);
> >I am not sure why we should disable IRQs. I think it can be >avoided.
>
> Suppose in multi CPU system, the kfree_rcu_shrink_scan function is runing on CPU2,
> and we just traverse to CPU2, and then call free_krc_page_cache function,
> if not disable irq, a interrupt may be occurs on CPU2 after the CPU2 corresponds to krcp variable 's lock be acquired, if the interrupt or softirq handler function to call kvfree_rcu function, in this function , acquire CPU2 corresponds to krcp variable 's lock , will happen deadlock.
> Or in single CPU scenario.
>
Right. Deadlock scenario. It went away from my head during writing that :)
Thanks!
--
Vlad Rezki
prev parent reply other threads:[~2021-01-30 11:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-29 8:04 [PATCH v2] kvfree_rcu: Release page cache under memory pressure qiang.zhang
[not found] ` <20210129141953.GA29827@pc638.lan>
2021-01-30 6:47 ` 回复: " Zhang, Qiang
2021-01-30 11:21 ` Uladzislau Rezki [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=20210130112152.GA1977@pc636 \
--to=urezki@gmail.com \
--cc=Qiang.Zhang@windriver.com \
--cc=joel@joelfernandes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=rcu@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