[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250217.154447.1251064594176317463.fujita.tomonori@gmail.com>
Date: Mon, 17 Feb 2025 15:44:47 +0900 (JST)
From: FUJITA Tomonori <fujita.tomonori@...il.com>
To: boqun.feng@...il.com
Cc: aliceryhl@...gle.com, fujita.tomonori@...il.com,
david.laight.linux@...il.com, linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org, netdev@...r.kernel.org, andrew@...n.ch,
hkallweit1@...il.com, tmgross@...ch.edu, ojeda@...nel.org,
alex.gaynor@...il.com, gary@...yguo.net, bjorn3_gh@...tonmail.com,
benno.lossin@...ton.me, a.hindborg@...sung.com, anna-maria@...utronix.de,
frederic@...nel.org, tglx@...utronix.de, arnd@...db.de,
jstultz@...gle.com, sboyd@...nel.org, mingo@...hat.com,
peterz@...radead.org, juri.lelli@...hat.com, vincent.guittot@...aro.org,
dietmar.eggemann@....com, rostedt@...dmis.org, bsegall@...gle.com,
mgorman@...e.de, vschneid@...hat.com, tgunders@...hat.com, me@...enk.dev
Subject: Re: [PATCH v10 1/8] sched/core: Add __might_sleep_precision()
On Sun, 16 Feb 2025 17:51:32 -0800
Boqun Feng <boqun.feng@...il.com> wrote:
>> > >> + unsigned int offsets)
>> > >> {
>> > >> /* Ratelimiting timestamp: */
>> > >> static unsigned long prev_jiffy;
>> > >> @@ -8740,8 +8723,10 @@ void __might_resched(const char *file, int line, unsigned int offsets)
>> > >> /* Save this before calling printk(), since that will clobber it: */
>> > >> preempt_disable_ip = get_preempt_disable_ip(current);
>> > >>
>> > >> - pr_err("BUG: sleeping function called from invalid context at %s:%d\n",
>> > >> - file, line);
>> > >> + if (len < 0)
>> > >> + len = strlen(file);
>> > >
>> > > No need for strlen(), just use a big number instead of -1.
>> > > Anything bigger than a sane upper limit on the filename length will do.
>> >
>> > Ah, that's right. Just passing the maximum precision (1<<15-1) works.
>> >
>> > The precision specifies the maximum length. vsnprintf() always
>> > iterates through a string until it reaches the maximum length or
>> > encounters the null terminator. So strlen() here is useless.
>> >
>> > Alice and Boqun, the above change is fine? Can I keep the tags?
>>
>> I'd probably like a comment explaining the meaning of this constant
>> somewhere, but sure ok with me.
>>
>
> Agreed. The code should be fine but need some comments.
Of course, I'll add some in the next version.
Thanks!
Powered by blists - more mailing lists