From patchwork Wed Jul 5 06:37:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13301710 Return-Path: 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 43076C001B0 for ; Wed, 5 Jul 2023 06:37:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AE2D68D0002; Wed, 5 Jul 2023 02:37:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A92A16B0074; Wed, 5 Jul 2023 02:37:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 95AC48D0002; Wed, 5 Jul 2023 02:37:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 88D346B0072 for ; Wed, 5 Jul 2023 02:37:22 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 45E56120544 for ; Wed, 5 Jul 2023 06:37:22 +0000 (UTC) X-FDA: 80976601524.17.9C46DF7 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf09.hostedemail.com (Postfix) with ESMTP id EF4D114000C for ; Wed, 5 Jul 2023 06:37:18 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=NRt67G4e; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf09.hostedemail.com: domain of 3ng-lZAYKCH0tvsfochpphmf.dpnmjovy-nnlwbdl.psh@flex--surenb.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=3ng-lZAYKCH0tvsfochpphmf.dpnmjovy-nnlwbdl.psh@flex--surenb.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1688539039; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=kEcsCBzNF4o70240RbNtRsxkJMv3dgoeG47F/eJErR4=; b=YK+mZ8qccuoA65UUep6if4yCNodjg1wZQbLQxVbXCKJYt74/M91Ir8I9qPnSrITzjZKVPh Tk3BIZJqtCWiYzobtjoIrvwRizmulpDThYJgoTc6MHO1SjnMZEmDf50aSILGJZZ7YgHfrO XiSYHJyupmsicEOSGo/tn6ZfE5BWe8g= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=NRt67G4e; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf09.hostedemail.com: domain of 3ng-lZAYKCH0tvsfochpphmf.dpnmjovy-nnlwbdl.psh@flex--surenb.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=3ng-lZAYKCH0tvsfochpphmf.dpnmjovy-nnlwbdl.psh@flex--surenb.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1688539039; a=rsa-sha256; cv=none; b=MFjRw63Srguzlj1jvQnRLn7+kogoYVs2aZxksoylj5hMCqclHInnRIFBngamV+nnivuUr9 t3uwVJi0bawAVGFoTUuXroxQr+9CljBuC1qA4ob88ZKDUJEiYdCD6BRedxFPjGKV4rJ9+Y 2QGawOPaLasfsw5TGqj19BCDZFN8de0= Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-c0d62f4487cso6568661276.0 for ; Tue, 04 Jul 2023 23:37:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1688539038; x=1691131038; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=kEcsCBzNF4o70240RbNtRsxkJMv3dgoeG47F/eJErR4=; b=NRt67G4eRCmPFMXhxD3qW9K9EDj0xnVdQKTKufRvQkcPo7ZdLBv0zTj1I+0oIpa2hf RNbwbPBRRogvAWVpk5UaiqbfxSKUz15RoJ7CB+USDdwHmnmfpV6jkLxbEnsYpFFZaO/V SHkrXnyB7eFzXg59ZHInsE6Ag/21l5iBDRtfRUxDxPZ/FU1OKcIdaR+keSSWazvkJh5Q 7s+3RLuRM38qG/NcRSerlS841aoCJMp0+XIoBRVOSxggq4iZYaH+zqxDmhUtoJFuHlZu D53jP1OcRKF4mM/4S+ltgmuuTXWPdfIQ3Qrpc4LEr92kprtgKQxmqXBhxsp8tdb8AsgV 55rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688539038; x=1691131038; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=kEcsCBzNF4o70240RbNtRsxkJMv3dgoeG47F/eJErR4=; b=RRwkophQq0900wVccyQvYZwxNh+4Z80tFodwAOoILr+kAl5mBwGsvkZkuTHUPlla13 76rYxrNKv9v98AkFoaz4N/eQDiCWdvH6Kc4/tU7JMUVPXY5r5mmFhmRedpt4vNgV/7HS FgAquveqLCQRjaBQOWM99n0mC94381znHeH80S8kJPZsNWBPRE28BVFJ9XjDSjO8M0eF yL030Lc9WZ9mCsCHmr82dGOgAbF5PKrS+VIoSU7NT+ZPs/LFWvQZ6QJXxP3ETjtwCPqt O+Ef3/16uzMCzU+238nuy8S0qADhfoV4EWc6jTYXRUPv1q34IN6v1JOEXgNtyqVz0TdU 7o7g== X-Gm-Message-State: ABy/qLYAouUdPuXplmjjsKv6SSBZeDNHRAvejnJz1EsM+/WqVoxvPvQj ApTVzXh/oVW2hgEH0o6T+Gt75JInVZ8= X-Google-Smtp-Source: APBJJlFxf2AFzH5E1himxE/0ay/K/ncJrIflv9U1K8XKuqoxYpjdV/ZXI10Rc5HBkhf6oCEZCsT7XVeCpvM= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:9164:ef9f:8918:e2b6]) (user=surenb job=sendgmr) by 2002:a25:ad96:0:b0:c5d:5b6f:f5c5 with SMTP id z22-20020a25ad96000000b00c5d5b6ff5c5mr31841ybi.4.1688539038122; Tue, 04 Jul 2023 23:37:18 -0700 (PDT) Date: Tue, 4 Jul 2023 23:37:10 -0700 In-Reply-To: <20230705063711.2670599-1-surenb@google.com> Mime-Version: 1.0 References: <20230705063711.2670599-1-surenb@google.com> X-Mailer: git-send-email 2.41.0.255.g8b1d071c50-goog Message-ID: <20230705063711.2670599-2-surenb@google.com> Subject: [PATCH v2 1/2] fork: lock VMAs of the parent process when forking From: Suren Baghdasaryan To: akpm@linux-foundation.org Cc: jirislaby@kernel.org, jacobly.alt@gmail.com, holger@applied-asynchrony.com, hdegoede@redhat.com, michel@lespinasse.org, jglisse@google.com, mhocko@suse.com, vbabka@suse.cz, hannes@cmpxchg.org, mgorman@techsingularity.net, dave@stgolabs.net, willy@infradead.org, liam.howlett@oracle.com, peterz@infradead.org, ldufour@linux.ibm.com, paulmck@kernel.org, mingo@redhat.com, will@kernel.org, luto@kernel.org, songliubraving@fb.com, peterx@redhat.com, david@redhat.com, dhowells@redhat.com, hughd@google.com, bigeasy@linutronix.de, kent.overstreet@linux.dev, punit.agrawal@bytedance.com, lstoakes@gmail.com, peterjung1337@gmail.com, rientjes@google.com, chriscli@google.com, axelrasmussen@google.com, joelaf@google.com, minchan@google.com, rppt@kernel.org, jannh@google.com, shakeelb@google.com, tatashin@google.com, edumazet@google.com, gthelen@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Suren Baghdasaryan X-Rspamd-Queue-Id: EF4D114000C X-Rspam-User: X-Rspam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yKodiS8f6YDlUgDm+5DpklaZqk/+yNtnGL4JW1v6XfsWdpWDVsa/5gq5QLIqycZk+scJgUFJ6CpN2xTsdETX83OLg4eOIaZh+naps3v6g383IWz9VMdiJznMhP/c372cvuNC3CAbvaLH5Lw4MTR+hUZ/6sjnYr4XM1WzCM/TkAk/Cp0juoe5ogTpOa9vp66ZJZ3I9UOg7LHWdWfAEySYU1SKvz02gR07B8yTlTYakximKqIjcPnqIGd3D+C+tZVd7GFf32tyZ58BO1YtUbFHynN8uFRdlBxCG6+9WHIzrksNEcxyRXHmmV8g2lUNXtExYKmKZY4KxhjBaM7XXFtGexCH90bGkFnMzQVDIPEJXgEF4AGjrQ3Kizva/81szOZkPzWZluPF/VEm/PpbWxxRHBdByqobkdTM01a7P0EydTB6e2fJICYlImwQixMzjfdgI/RDJdujJQ0ObRValuUHbm7riurG+esQ7YT+01/YNiwJ0SHEuciLs8nCCzEj4nBRZjU7ZwTWPYSxCZD3wAWLx4+I2XuHPNkxKAhJZzguptld3EOCwRkPcazA4OgcVYm0YTrHRQs4v0TFSP7yGFHslo9HNyEB/dn3O2KQHfXece+W0WrElDAIERklUO1wlNPFUuyT/2JtsdWjel1smdUI3VnQ99pEDIt6vtphGxz19zjoVhbAZfkykYpHInvx3JOVl27lHA62Yq2by3vcdCHYld0GqjvsEY5XAF4ui34awm7nG/4BBo5vgX4K7AMAHAuSjrExmDuwGAZmzfPnAyA0paUy42XZ+YzmaaR7BUWaFydOS6Lh+Nk3JA1eCF3gu7GsF6qUPwrth2rV0ZqUv4yM3v0A== 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: When forking a child process, parent write-protects an anonymous page and COW-shares it with the child being forked using copy_present_pte(). Parent's TLB is flushed right before we drop the parent's mmap_lock in dup_mmap(). If we get a write-fault before that TLB flush in the parent, and we end up replacing that anonymous page in the parent process in do_wp_page() (because, COW-shared with the child), this might lead to some stale writable TLB entries targeting the wrong (old) page. Similar issue happened in the past with userfaultfd (see flush_tlb_page() call inside do_wp_page()). Lock VMAs of the parent process when forking a child, which prevents concurrent page faults during fork operation and avoids this issue. This fix can potentially regress some fork-heavy workloads. Kernel build time did not show noticeable regression on a 56-core machine while a stress test mapping 10000 VMAs and forking 5000 times in a tight loop shows ~5% regression. If such fork time regression is unacceptable, disabling CONFIG_PER_VMA_LOCK should restore its performance. Further optimizations are possible if this regression proves to be problematic. Suggested-by: David Hildenbrand Reported-by: Jiri Slaby Closes: https://lore.kernel.org/all/dbdef34c-3a07-5951-e1ae-e9c6e3cdf51b@kernel.org/ Reported-by: Holger Hoffstätte Closes: https://lore.kernel.org/all/b198d649-f4bf-b971-31d0-e8433ec2a34c@applied-asynchrony.com/ Reported-by: Jacob Young Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217624 Fixes: 0bff0aaea03e ("x86/mm: try VMA lock-based page fault handling first") Cc: stable@vger.kernel.org Signed-off-by: Suren Baghdasaryan --- kernel/fork.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/fork.c b/kernel/fork.c index b85814e614a5..d2e12b6d2b18 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -686,6 +686,7 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm, for_each_vma(old_vmi, mpnt) { struct file *file; + vma_start_write(mpnt); if (mpnt->vm_flags & VM_DONTCOPY) { vm_stat_account(mm, mpnt->vm_flags, -vma_pages(mpnt)); continue; From patchwork Wed Jul 5 06:37:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13301711 Return-Path: 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 5AE1DC001DF for ; Wed, 5 Jul 2023 06:37:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AE3A98D0003; Wed, 5 Jul 2023 02:37:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A44DA6B0074; Wed, 5 Jul 2023 02:37:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 90CA48D0003; Wed, 5 Jul 2023 02:37:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 8422C6B0072 for ; Wed, 5 Jul 2023 02:37:23 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 50B4614059A for ; Wed, 5 Jul 2023 06:37:23 +0000 (UTC) X-FDA: 80976601566.08.92C389F Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) by imf03.hostedemail.com (Postfix) with ESMTP id 63D9B20021 for ; Wed, 5 Jul 2023 06:37:21 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=wGZz06ti; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf03.hostedemail.com: domain of 3oA-lZAYKCH8vxuhqejrrjoh.frpolqx0-ppnydfn.ruj@flex--surenb.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3oA-lZAYKCH8vxuhqejrrjoh.frpolqx0-ppnydfn.ruj@flex--surenb.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1688539041; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=zhr6pJDsNrLzcgsJWM8+NlUbxGJ2RjB7mS40bDz+nag=; b=FmvKPu1stl064vQBkoz8iqD1MvDl8pq/Tv+AWAmfxJ8p6Dbt+sJLVRrdkTZLcvq9/DaVky hOzEtOEVwzd8tHWp/nlEPWG4SYwRtJwWUwMh2wNnS+vaQVqYzBVO7YGaAaUkNjFoXV272t O2qhyiLK0g9gWD47IBR/mJV3Ff1iq1Q= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=wGZz06ti; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf03.hostedemail.com: domain of 3oA-lZAYKCH8vxuhqejrrjoh.frpolqx0-ppnydfn.ruj@flex--surenb.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3oA-lZAYKCH8vxuhqejrrjoh.frpolqx0-ppnydfn.ruj@flex--surenb.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1688539041; a=rsa-sha256; cv=none; b=8AZpFpG6v/AvhbwRZN7TrRob8xYY7NyKLqvuOqePk3E+vKzolhsTo0x70bqpZ3ZW4eWUxM IuhvfeSoAb/0jL7ImB7dDJGwSURJfQsHaPcyUGfX6tuqAPpZkRsTgrSQkCWPK+k3DoOGyQ JiiL6CzGKNlu4Kf84hdOTF8WEFtWgMY= Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-57059f90cc5so69039927b3.0 for ; Tue, 04 Jul 2023 23:37:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1688539040; x=1691131040; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=zhr6pJDsNrLzcgsJWM8+NlUbxGJ2RjB7mS40bDz+nag=; b=wGZz06tiAGOYOW1oR9igBCSCESoMLrvNQ4Is6Pq7jt8gRNGlk1OlqZ3GkhB+7tB7P9 9lnfKV1ZOPx85SiPB01L2VOYkfUHMYQugjqIBBmzYRd9nmOCGL2TtTmutyFGYvZrS9jQ +W0EPlKnQP+wOFnIQ4R6jDrukMoAYrbfHMtMDFmynXYRiAD9rYASdisWn+t9ZO9ysXzw pu71VB50nQ9GaYyt1jma1y3S/PyVvAUT4Fg+kD4KEc6TcpNqzMQ1FQUr40YrhLdj2XyJ l2odp0IjyHycFROKoN2GV3n72IrNyOtaK4/hhb8CV/GjubqvLQRS7I2/YogapwLtjdfi kP9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688539040; x=1691131040; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zhr6pJDsNrLzcgsJWM8+NlUbxGJ2RjB7mS40bDz+nag=; b=CFSxrli7XmegOKVj5z5mO0ixbbX8+dHUdgo9ajpBpb/0yzv73mJzRkOHoLc0UO+obs IcuKtA3UWapMmnSCj/gWLwb6Ho0uOPpuwWJOgwF6Du+QPd1lbVerovO7h4vdNRaxcuwZ ge3jwxcR8YG4DNAs3SWWqqyqX7toBkdfFTJ4tRi6st2TWFQOLjV/Jtzfe2M6tVO2izAO bKRaeqTqBoczdNA9evTy1yB0eMa+Ai6201p1vaL8mze6JTJfZsNg5jgLzUsDtL2YA3V7 Nq8p84H25Pas01urAB7JrdBfqL32wfFszATJlXZea9rMWnIKRRoCsCrE9WyI27JQVJ8L sv+g== X-Gm-Message-State: ABy/qLbiCFbSu5yrNBUGE+sMN4aY0hZBN3mD80fIChMEhmlPHlxRkUAZ XQOjGCSNDAcLBH2KsBjqWXmU1EoWT7A= X-Google-Smtp-Source: APBJJlGRXrDm2+UHaaQ2lMndANUDPYXN3L5xPOFiKmeuHtoExxhUVsaVOnCv/ExXrwiSlS2rc6+mCts1FPc= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:9164:ef9f:8918:e2b6]) (user=surenb job=sendgmr) by 2002:a81:ca44:0:b0:573:3897:c925 with SMTP id y4-20020a81ca44000000b005733897c925mr109816ywk.6.1688539040473; Tue, 04 Jul 2023 23:37:20 -0700 (PDT) Date: Tue, 4 Jul 2023 23:37:11 -0700 In-Reply-To: <20230705063711.2670599-1-surenb@google.com> Mime-Version: 1.0 References: <20230705063711.2670599-1-surenb@google.com> X-Mailer: git-send-email 2.41.0.255.g8b1d071c50-goog Message-ID: <20230705063711.2670599-3-surenb@google.com> Subject: [PATCH v2 2/2] mm: disable CONFIG_PER_VMA_LOCK until its fixed From: Suren Baghdasaryan To: akpm@linux-foundation.org Cc: jirislaby@kernel.org, jacobly.alt@gmail.com, holger@applied-asynchrony.com, hdegoede@redhat.com, michel@lespinasse.org, jglisse@google.com, mhocko@suse.com, vbabka@suse.cz, hannes@cmpxchg.org, mgorman@techsingularity.net, dave@stgolabs.net, willy@infradead.org, liam.howlett@oracle.com, peterz@infradead.org, ldufour@linux.ibm.com, paulmck@kernel.org, mingo@redhat.com, will@kernel.org, luto@kernel.org, songliubraving@fb.com, peterx@redhat.com, david@redhat.com, dhowells@redhat.com, hughd@google.com, bigeasy@linutronix.de, kent.overstreet@linux.dev, punit.agrawal@bytedance.com, lstoakes@gmail.com, peterjung1337@gmail.com, rientjes@google.com, chriscli@google.com, axelrasmussen@google.com, joelaf@google.com, minchan@google.com, rppt@kernel.org, jannh@google.com, shakeelb@google.com, tatashin@google.com, edumazet@google.com, gthelen@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Suren Baghdasaryan X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 63D9B20021 X-Stat-Signature: ttq978w3thgg7y6g9gic8i5o6jp6gmsi X-Rspam-User: X-HE-Tag: 1688539041-299970 X-HE-Meta: U2FsdGVkX19n6qIWeWiIliD4oAcAeVltnMhA3rS+3wlzHnrXQdy3HjeJVGGjneimZn2vSEZaXcFSvVuStJ8A8yx/6syC6f0LLw733eTtiNAe2fdlRyEFid4pm1BvSAbRaBsosWfCOrtRag/DpSIBs8i/r7q8DexlEZh4UVI8yswx3w+BXqp2zKp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P0TFMIZFHsJTStEsEGgExtAPdQQ1bi6o9ijZnWiekJqUyC5D3FkYPo28Jdj2sB6pAncwHaHkPXzWjTCxOXfAnLpr3c56VMrZ/r/CBzrA9LCY0/CYIT56Y9HpFk5nmuhHoBXLlgxomcPmvXMslCGHgXeiOi8+G7qvNrnQgpQQrCMi71s/4QzrsC4OGDmdvdKovzC2sa+gWdMIbdi4b0RQ6x0wP76q72vnRr2ifSL3W+gJa/FIEzw/KrA8r8TdLo/d8IlZcMWLTfmC8R7EarSoS70R/vNQAeW/9yVsoo7owtIaDVIqFakXSbjjX3IejJsFl/gLRcnyRfxYmQ0jDfFj+LoSgje3FjuBeOO9hz/9LZ9iQu8Gj4ToG+/nLq2japWLfy/yYSVxRqu8qpWtFkqN/mjkAUkk3MnczBd8S5SpL/0jSXfuPr1u5TU2MikQawrUWM4wqPfYy3rCONMmeMt89kIRsjRZNu0UuT1Xru9tYI389HTjmSy+Xb4Us8MGbr0MSHRkiAof/ye8DhBYRotWJkyxKVhaSGHoG5f1ioHViaw== 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: A memory corruption was reported in [1] with bisection pointing to the patch [2] enabling per-VMA locks for x86. Disable per-VMA locks config to prevent this issue while the problem is being investigated. This is expected to be a temporary measure. [1] https://bugzilla.kernel.org/show_bug.cgi?id=217624 [2] https://lore.kernel.org/all/20230227173632.3292573-30-surenb@google.com Reported-by: Jiri Slaby Closes: https://lore.kernel.org/all/dbdef34c-3a07-5951-e1ae-e9c6e3cdf51b@kernel.org/ Reported-by: Jacob Young Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217624 Fixes: 0bff0aaea03e ("x86/mm: try VMA lock-based page fault handling first") Cc: stable@vger.kernel.org Signed-off-by: Suren Baghdasaryan --- mm/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/Kconfig b/mm/Kconfig index 09130434e30d..0abc6c71dd89 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -1224,8 +1224,9 @@ config ARCH_SUPPORTS_PER_VMA_LOCK def_bool n config PER_VMA_LOCK - def_bool y + bool "Enable per-vma locking during page fault handling." depends on ARCH_SUPPORTS_PER_VMA_LOCK && MMU && SMP + depends on BROKEN help Allow per-vma locking during page fault handling.