From: Tejun Heo <tj@kernel.org>
To: Yu Kuai <yukuai1@huaweicloud.com>
Cc: hch@lst.de, josef@toxicpanda.com, axboe@kernel.dk,
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 11:10:28 -1000 [thread overview]
Message-ID: <Y306xJV6aNXd94kb@slm.duckdns.org> (raw)
In-Reply-To: <3da991c6-21e4-8ed8-ba75-ccb92059f0ae@huaweicloud.com>
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.
Thanks.
--
tejun
next prev parent reply other threads:[~2022-11-22 21:10 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 2/5] blk-iocost: improve hanlder of match_u64() Yu Kuai
2022-11-04 2:39 ` [PATCH v2 3/5] blk-iocost: don't allow to configure bio based device 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
2022-11-14 22:07 ` Tejun Heo
2022-11-15 1:16 ` Yu Kuai
2022-11-17 11:28 ` Yu Kuai
2022-11-22 21:10 ` Tejun Heo [this message]
2022-11-23 0:14 ` Jens Axboe
2022-11-23 0:42 ` Tejun Heo
2022-11-23 10:22 ` Yu Kuai
2022-12-05 9:39 ` Yu Kuai
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
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=Y306xJV6aNXd94kb@slm.duckdns.org \
--to=tj@kernel.org \
--cc=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=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
all inboxes | Powered by JetHome®