From: Ryan Roberts <ryan.roberts@arm.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Yury Norov <yury.norov@gmail.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [BUG] v6.3-rc2 regresses sched_getaffinity() for arm64
Date: Wed, 15 Mar 2023 09:17:58 +0000 [thread overview]
Message-ID: <765586c5-1009-87b2-094b-2391d0454cd2@arm.com> (raw)
In-Reply-To: <CAHk-=whaMzSk6kjxUMvOKK=T2EKWmcyJ_QV0JCowos4pM2a7yw@mail.gmail.com>
On 15/03/2023 02:48, Linus Torvalds wrote:
> On Tue, Mar 14, 2023 at 6:35 PM Linus Torvalds
> <torvalds@linux-foundation.org> wrote:
>>
>> So this does look like purely a sched_getaffinity() thing (including
>> the compat handling for same).
>>
>> And I can see why sched_getaffinity() uses cpumask_size(): we have no
>> other good helper for this.
>
> I decided that the cleanest fix is to just keep the cpumask_size() use
> as-is, and just use zalloc_cpumask_var() to make sure the cpumask is
> fully initialized.
>
> Yes, we could play games with the exact size, but there just isn't any
> excuse for it. Either it's a small on-stack allocation that gets
> copied to user space (in which case we really are better off just
> initializing it instead of doing anything clever), or it's an explicit
> allocation due to the x86-64 MAXSMP case (in which case zeroing the
> allocation is the least of our problems).
>
> And zeroing the cpumask was what other somewhat similar cases seemed
> to be doing, so it's consistent.
Thanks for the fast response and clear explanation! FWIW, the fix you committed
looks sensible to me.
>
> I've pushed out my fix. It looks ObviouslyCorrect(tm), but it would be
> good to get verification that it does indeed fix things for you.
I tested at 6015b1aca1a233379625385feb01dd014aca60b5 and all looks good now, so:
Tested-by: Ryan Roberts <ryan.roberts@arm.com>
>
> Because sometimes things look a bit more obvious than they actually are ;)
>
> Linus
prev parent reply other threads:[~2023-03-15 9:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-14 22:41 Ryan Roberts
2023-03-15 0:51 ` Linus Torvalds
2023-03-15 1:35 ` Linus Torvalds
2023-03-15 2:48 ` Linus Torvalds
2023-03-15 9:17 ` Ryan Roberts [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=765586c5-1009-87b2-094b-2391d0454cd2@arm.com \
--to=ryan.roberts@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=yury.norov@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
all inboxes | Powered by JetHome®