From: Dave Hansen <dave.hansen@intel.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
"keescook@chromium.org" <keescook@chromium.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"x86@kernel.org" <x86@kernel.org>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [GIT PULL] x86/shstk for 6.4
Date: Tue, 16 May 2023 13:42:38 -0700 [thread overview]
Message-ID: <025f7715-536e-bca0-3e44-7bddd8668b35@intel.com> (raw)
In-Reply-To: <CAHk-=wg6TWSvb8Lk5uEu=QKQRFj7vewMsqLhuah4_7r2S=dXWA@mail.gmail.com>
On 5/16/23 13:38, Linus Torvalds wrote:
> On Mon, May 15, 2023 at 3:40 PM Linus Torvalds
> <torvalds@linux-foundation.org> wrote:
>> So I *think* fork() could do something like this:
>>
>> struct fork_cookie; // dummy type purely for type checking
>> static struct fork_cookie *is_singe_threaded(void)
>> {
>> struct mm_struct *mm = current->mm;
>> mutex_lock(&mm->fork_lock);
> Actually, let's not even bother with a new fork_lock.
>
> I for some reason thought that fork only took the mmap_lock for
> reading (because it kind of does just read the old VM data), but when
> I actually look at dup_mmap() I notice that what it does is actually
> just
>
> if (mmap_write_lock_killable(oldmm)) ..
>
> and so I think we can just use that as the lock.
>
> So then all we'd need is to use mmap_read_lock(mm) in kthread_use_mm()
> around the mmgrab.
>
> I don't think we even need it in kthread_unuse_mm(), because
> *decrementing* the mm counters isn't even something we need to worry
> about.
>
> How does that sound?
Sounds promising. I was really hesitant to bring a new lock into the world.
I need to digest what you write yesterday and convince myself a little
more that doing it at kthread_unuse_mm() is sufficient, but that's my
problem. ;)
next prev parent reply other threads:[~2023-05-16 20:42 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-24 21:21 [GIT PULL] x86/shstk for 6.4 Dave Hansen
2023-04-28 18:17 ` Linus Torvalds
2023-04-29 0:26 ` Edgecombe, Rick P
2023-04-29 0:40 ` Dave Hansen
2023-05-06 19:34 ` Linus Torvalds
2023-05-06 20:09 ` Linus Torvalds
2023-05-07 0:18 ` Edgecombe, Rick P
2023-05-07 0:38 ` Linus Torvalds
2023-05-07 15:57 ` Edgecombe, Rick P
2023-05-08 22:57 ` Dave Hansen
2023-05-08 23:31 ` Linus Torvalds
2023-05-08 23:47 ` Linus Torvalds
2023-05-12 17:34 ` Dave Hansen
2023-05-12 21:55 ` Linus Torvalds
2023-05-15 21:36 ` Dave Hansen
2023-05-15 21:37 ` Dave Hansen
2023-05-15 22:40 ` Linus Torvalds
2023-05-15 23:02 ` Linus Torvalds
2023-05-16 20:38 ` Linus Torvalds
2023-05-16 20:42 ` Dave Hansen [this message]
2023-05-09 0:07 ` Dave Hansen
2023-05-07 0:10 ` Edgecombe, Rick P
2023-05-07 0:19 ` Linus Torvalds
2023-05-07 16:24 ` Edgecombe, Rick P
2023-05-15 21:22 ` Deepak Gupta
2023-05-25 16:20 ` Mark Brown
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=025f7715-536e-bca0-3e44-7bddd8668b35@intel.com \
--to=dave.hansen@intel.com \
--cc=akpm@linux-foundation.org \
--cc=dave.hansen@linux.intel.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=rick.p.edgecombe@intel.com \
--cc=torvalds@linux-foundation.org \
--cc=x86@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