Message ID | 20220128131006.67712-26-michel@lespinasse.org (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77B8CC433FE for <linux-mm@archiver.kernel.org>; Fri, 28 Jan 2022 13:10:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 541FF6B0082; Fri, 28 Jan 2022 08:10:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 206076B00A7; Fri, 28 Jan 2022 08:10:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 841886B009B; Fri, 28 Jan 2022 08:10:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0208.hostedemail.com [216.40.44.208]) by kanga.kvack.org (Postfix) with ESMTP id 690B16B0096 for <linux-mm@kvack.org>; Fri, 28 Jan 2022 08:10:13 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 246AB824C421 for <linux-mm@kvack.org>; Fri, 28 Jan 2022 13:10:13 +0000 (UTC) X-FDA: 79079729106.27.84F4586 Received: from server.lespinasse.org (server.lespinasse.org [63.205.204.226]) by imf27.hostedemail.com (Postfix) with ESMTP id B21204000E for <linux-mm@kvack.org>; Fri, 28 Jan 2022 13:10:12 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=lespinasse.org; i=@lespinasse.org; q=dns/txt; s=srv-52-ed; t=1643375407; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : from; bh=RZET6KbJQW7VW1QW9ZpHlj8GvOwKrY4N8XGYpxkjsRk=; b=lg7mwIi1UUybUJbUCaCkKGLFeyjCzcgmEUUUtMqA2m435D54fPR9BuFNzrtW1IzZHziPP IZmxP4OfpkTNZIZBw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lespinasse.org; i=@lespinasse.org; q=dns/txt; s=srv-52-rsa; t=1643375407; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : from; bh=RZET6KbJQW7VW1QW9ZpHlj8GvOwKrY4N8XGYpxkjsRk=; b=I5CUBm8DMAq9QhQZuDTlz8HPE2GIJe8Pl3qJLv9+aAuCuvlUoLHPmQcQy4o+btcgoFyJW 3Y7vobYfMEpLBYKSi+cUmMCTZmiDcDl9/0RST+kJVyF9iQstS//R4caHv/PgITt2zBu5Yqr Gbf03b8Kb9YrDIUKGUSbIFHu7CjsWATo32dn+aB5Kn4rvTcVkILtwbJNea7ub2Yc6ff0esG y0U2jbBv910miMShGu4zYhfJNj6ssvqdDUaNOZfYyHezMQlfu9JyzcjMlEooD06liuQ1w+G iP51OphoqkfoVswBHn3l8LMgiQgbkAt1EBXgCT9AJwbLwtb4u87lUpO7PAIw== Received: from zeus.lespinasse.org (zeus.lespinasse.org [IPv6:fd00::150:0]) by server.lespinasse.org (Postfix) with ESMTPS id 34E4D160AAF; Fri, 28 Jan 2022 05:10:07 -0800 (PST) Received: by zeus.lespinasse.org (Postfix, from userid 1000) id 116CF20561; Fri, 28 Jan 2022 05:10:07 -0800 (PST) From: Michel Lespinasse <michel@lespinasse.org> To: Linux-MM <linux-mm@kvack.org>, linux-kernel@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org> Cc: kernel-team@fb.com, Laurent Dufour <ldufour@linux.ibm.com>, Jerome Glisse <jglisse@google.com>, Peter Zijlstra <peterz@infradead.org>, Michal Hocko <mhocko@suse.com>, Vlastimil Babka <vbabka@suse.cz>, Davidlohr Bueso <dave@stgolabs.net>, Matthew Wilcox <willy@infradead.org>, Liam Howlett <liam.howlett@oracle.com>, Rik van Riel <riel@surriel.com>, Paul McKenney <paulmck@kernel.org>, Song Liu <songliubraving@fb.com>, Suren Baghdasaryan <surenb@google.com>, Minchan Kim <minchan@google.com>, Joel Fernandes <joelaf@google.com>, David Rientjes <rientjes@google.com>, Axel Rasmussen <axelrasmussen@google.com>, Andy Lutomirski <luto@kernel.org>, Michel Lespinasse <michel@lespinasse.org> Subject: [PATCH v2 25/35] mm: add mmu_notifier_trylock() and mmu_notifier_unlock() Date: Fri, 28 Jan 2022 05:09:56 -0800 Message-Id: <20220128131006.67712-26-michel@lespinasse.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220128131006.67712-1-michel@lespinasse.org> References: <20220128131006.67712-1-michel@lespinasse.org> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: B21204000E X-Stat-Signature: km7wh8ktwwhsnteqa88wpsbgc884nrj8 X-Rspam-User: nil Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=lespinasse.org header.s=srv-52-ed header.b=lg7mwIi1; dkim=pass header.d=lespinasse.org header.s=srv-52-rsa header.b=I5CUBm8D; spf=pass (imf27.hostedemail.com: domain of walken@lespinasse.org designates 63.205.204.226 as permitted sender) smtp.mailfrom=walken@lespinasse.org; dmarc=pass (policy=none) header.from=lespinasse.org X-HE-Tag: 1643375412-638423 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> |
Series |
Speculative page faults
|
expand
|
diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h index ace76fe91c0c..d0430410fdd8 100644 --- a/include/linux/mmu_notifier.h +++ b/include/linux/mmu_notifier.h @@ -772,4 +772,29 @@ static inline void mmu_notifier_synchronize(void) #endif /* CONFIG_MMU_NOTIFIER */ +#if defined(CONFIG_MMU_NOTIFIER) && defined(CONFIG_SPECULATIVE_PAGE_FAULT) + +static inline bool mmu_notifier_trylock(struct mm_struct *mm) +{ + return percpu_down_read_trylock(mm->mmu_notifier_lock); +} + +static inline void mmu_notifier_unlock(struct mm_struct *mm) +{ + percpu_up_read(mm->mmu_notifier_lock); +} + +#else + +static inline bool mmu_notifier_trylock(struct mm_struct *mm) +{ + return true; +} + +static inline void mmu_notifier_unlock(struct mm_struct *mm) +{ +} + +#endif + #endif /* _LINUX_MMU_NOTIFIER_H */
These new functions are to be used when firing MMU notifications without holding any of the mmap or rmap locks, as is the case with speculative page fault handlers. Signed-off-by: Michel Lespinasse <michel@lespinasse.org> --- include/linux/mmu_notifier.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)