From: Matthew Wilcox <willy@infradead.org>
To: Mateusz Guzik <mjguzik@gmail.com>
Cc: torvalds@linux-foundation.org, akpm@linux-foundation.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH] mm: remove unintentional voluntary preemption in get_mmap_lock_carefully
Date: Sun, 20 Aug 2023 19:12:16 +0100 [thread overview]
Message-ID: <ZOJXgFJybD1ljCHL@casper.infradead.org> (raw)
In-Reply-To: <20230820104303.2083444-1-mjguzik@gmail.com>
On Sun, Aug 20, 2023 at 12:43:03PM +0200, Mateusz Guzik wrote:
> Found by checking off-CPU time during kernel build (like so:
> "offcputime-bpfcc -Ku"), sample backtrace:
> finish_task_switch.isra.0
> __schedule
> __cond_resched
> lock_mm_and_find_vma
> do_user_addr_fault
> exc_page_fault
> asm_exc_page_fault
> - sh (4502)
Now I'm awake, this backtrace really surprises me. Do we not check
need_resched on entry? It seems terribly unlikely that need_resched
gets set between entry and getting to this point, so I guess we must
not.
I suggest the version of the patch which puts might_sleep() before the
mmap_read_trylock() is the right one to apply. It's basically what
we've done forever, except that now we'll be rescheduling without the
mmap lock held, which just seems like an overall win.
next prev parent reply other threads:[~2023-08-20 18:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-20 10:43 Mateusz Guzik
2023-08-20 11:36 ` Matthew Wilcox
2023-08-20 12:41 ` Mateusz Guzik
2023-08-20 12:46 ` Mateusz Guzik
2023-08-20 12:47 ` Linus Torvalds
2023-08-20 12:59 ` Linus Torvalds
2023-08-20 13:08 ` Mateusz Guzik
2023-08-20 13:00 ` Mateusz Guzik
2023-08-20 18:12 ` Matthew Wilcox [this message]
2023-08-21 1:13 ` Mateusz Guzik
2023-08-21 3:58 ` Matthew Wilcox
2023-08-21 4:55 ` Linus Torvalds
2023-08-21 5:38 ` Linus Torvalds
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=ZOJXgFJybD1ljCHL@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mjguzik@gmail.com \
--cc=torvalds@linux-foundation.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