From: Jens Axboe <axboe@kernel.dk>
To: Tejun Heo <tj@kernel.org>, Yu Kuai <yukuai1@huaweicloud.com>
Cc: hch@lst.de, josef@toxicpanda.com, cgroups@vger.kernel.org,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
yi.zhang@huawei.com, "yukuai (C)" <yukuai3@huawei.com>
Subject: Re: [PATCH v2 4/5] blk-iocost: fix sleeping in atomic context warnning
Date: Tue, 22 Nov 2022 17:14:29 -0700 [thread overview]
Message-ID: <1f52ccb1-c357-a2a0-ef9d-48d7e2eb51f8@kernel.dk> (raw)
In-Reply-To: <Y306xJV6aNXd94kb@slm.duckdns.org>
On 11/22/22 2:10 PM, Tejun Heo wrote:
> On Thu, Nov 17, 2022 at 07:28:50PM +0800, Yu Kuai wrote:
>> Hi, Tejun!
>>
>> 在 2022/11/15 6:07, Tejun Heo 写道:
>>
>>>
>>> Any chance I can persuade you into updating match_NUMBER() helpers to not
>>> use match_strdup()? They can easily disable irq/preemption and use percpu
>>> buffers and we won't need most of this patchset.
>>
>> Does the following patch match your proposal?
>>
>> diff --git a/lib/parser.c b/lib/parser.c
>> index bcb23484100e..ded652471919 100644
>> --- a/lib/parser.c
>> +++ b/lib/parser.c
>> @@ -11,6 +11,24 @@
>> #include <linux/slab.h>
>> #include <linux/string.h>
>>
>> +#define U64_MAX_SIZE 20
>> +
>> +static DEFINE_PER_CPU(char, buffer[U64_MAX_SIZE]);
>> +
>> +static char *get_buffer(void)
>> +{
>> + preempt_disable();
>> + local_irq_disable();
>> +
>> + return this_cpu_ptr(buffer);
>> +}
>> +
>> +static void put_buffer(void)
>> +{
>> + local_irq_enable();
>> + preempt_enable();
>> +}
>> +
>>
>> Then match_strdup() and kfree() in match_NUMBER() can be replaced with
>> get_buffer() and put_buffer().
>
> Sorry about the late reply. Yeah, something like this.
Doesn't local_irq_disable() imply preemption disable as well?
--
Jens Axboe
next prev parent reply other threads:[~2022-11-23 0:14 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-04 2:39 [PATCH v2 0/5] blk-iocost: random patches to improve configuration Yu Kuai
2022-11-04 2:39 ` [PATCH v2 1/5] blk-iocost: cleanup ioc_qos_write() and ioc_cost_model_write() Yu Kuai
2022-11-04 2:39 ` [PATCH v2 3/5] blk-iocost: don't allow to configure bio based device Yu Kuai
[not found] ` <20221104023938.2346986-1-yukuai1-XF6JlduFytWkHkcT6e4Xnw@public.gmane.org>
2022-11-04 2:39 ` [PATCH v2 2/5] blk-iocost: improve hanlder of match_u64() Yu Kuai
2022-11-04 2:39 ` [PATCH v2 4/5] blk-iocost: fix sleeping in atomic context warnning Yu Kuai
2022-11-04 5:17 ` Christoph Hellwig
2022-11-07 5:56 ` Christoph Hellwig
[not found] ` <20221104023938.2346986-5-yukuai1-XF6JlduFytWkHkcT6e4Xnw@public.gmane.org>
2022-11-14 22:07 ` Tejun Heo
2022-11-15 1:16 ` Yu Kuai
[not found] ` <Y3K8MSFWw8eTnxtm-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2022-11-17 11:28 ` Yu Kuai
2022-11-22 21:10 ` Tejun Heo
2022-11-23 0:14 ` Jens Axboe [this message]
2022-11-23 0:42 ` Tejun Heo
[not found] ` <Y31sYFdA2lHIvjt3-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2022-11-23 10:22 ` Yu Kuai
[not found] ` <ec3754a6-3249-51ab-b659-fd795884e346-XF6JlduFytWkHkcT6e4Xnw@public.gmane.org>
2022-12-05 9:39 ` Yu Kuai
[not found] ` <f227e4bd-c74b-a02e-2a02-11a1376ee4f9-XF6JlduFytWkHkcT6e4Xnw@public.gmane.org>
2022-12-08 15:59 ` Tejun Heo
2022-11-04 2:39 ` [PATCH v2 5/5] blk-iocost: read params inside lock in sysfs apis Yu Kuai
[not found] ` <20221104023938.2346986-6-yukuai1-XF6JlduFytWkHkcT6e4Xnw@public.gmane.org>
2022-11-04 5:17 ` Christoph Hellwig
2022-11-07 5:56 ` Christoph Hellwig
2022-11-12 6:13 ` [PATCH v2 0/5] blk-iocost: random patches to improve configuration Yu Kuai
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=1f52ccb1-c357-a2a0-ef9d-48d7e2eb51f8@kernel.dk \
--to=axboe@kernel.dk \
--cc=cgroups@vger.kernel.org \
--cc=hch@lst.de \
--cc=josef@toxicpanda.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.org \
--cc=yi.zhang@huawei.com \
--cc=yukuai1@huaweicloud.com \
--cc=yukuai3@huawei.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).