From patchwork Mon Jan 9 20:53:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13094274 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 53C28C54EBD for ; Mon, 9 Jan 2023 20:54:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E53678E000C; Mon, 9 Jan 2023 15:54:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E032C8E0001; Mon, 9 Jan 2023 15:54:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C86AC8E000C; Mon, 9 Jan 2023 15:54:03 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id B965A8E0001 for ; Mon, 9 Jan 2023 15:54:03 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 746D280F31 for ; Mon, 9 Jan 2023 20:54:03 +0000 (UTC) X-FDA: 80336462766.16.BACFE0A Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf13.hostedemail.com (Postfix) with ESMTP id E13FE20015 for ; Mon, 9 Jan 2023 20:54:01 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=hJQlgWQO; spf=pass (imf13.hostedemail.com: domain of 36H68YwYKCPsvxuhqejrrjoh.frpolqx0-ppnydfn.ruj@flex--surenb.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=36H68YwYKCPsvxuhqejrrjoh.frpolqx0-ppnydfn.ruj@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673297641; 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=bU2TYXI/IQ+ahWPrvtMjvIvPP35LcWsiAJFQ60YWV8o=; b=muLchG3kYaI5wIjA6nftkun6WgvW9OTu/Z9u3ngC/SeEroXOMtTFug8Uxj5/UMe50IXjx/ 3Nkt41+AKm79hktPyMEpItAr8wSoYJaqQibpzgab1j45OYCNN3//rFvBAfv3SMGtQP1Ms3 zRwKMA4jER3WCjViqHQLBrFxwKNby68= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=hJQlgWQO; spf=pass (imf13.hostedemail.com: domain of 36H68YwYKCPsvxuhqejrrjoh.frpolqx0-ppnydfn.ruj@flex--surenb.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=36H68YwYKCPsvxuhqejrrjoh.frpolqx0-ppnydfn.ruj@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673297641; a=rsa-sha256; cv=none; b=TsE0nk8yDkxBjXeENM3EKUIf1J/U16jNhQG7yIdp0nrEmm6/nESxJcZNBIkeXZ/V3Zjew9 R0IXnlSGuSYwZ23ng52Or4LyEYwUdUxF0k0U2JTjTMblU0j2wV6Nw3tqWkq6ttpnG7AgVJ NixisormLK97WO9ROSeiBpHEhZZwQQQ= Received: by mail-yb1-f201.google.com with SMTP id k204-20020a256fd5000000b007b8b040bc50so8772972ybc.1 for ; Mon, 09 Jan 2023 12:54:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=bU2TYXI/IQ+ahWPrvtMjvIvPP35LcWsiAJFQ60YWV8o=; b=hJQlgWQOwjt9bdNS4iNCFQHGlLFypCJo9NibsA7lH+Cj66pCbZCU+CxVh9F7A2fm7T vmlH3bAYg1kSOc6vTNCehxfbrsiSwMkUwfklPcXaZBTBOgsQNuQ1lURfneHqEpASj7ak 72wsJeHj+71ppFuT3bry8xcf97dMVhsy87IzDxduellVAKg7BiJc4vIK8HA7ompTnbjq +gURuiw11LvdH0ad+L6DkctzinvpOQbzYQIPe9DQz0Et4Siymb/UJSUp4isr8x/TUfSb z+/96aen7RzYU/fA94YBNLJOwTLnQ/SBQCaJx176+XVEeqKe1Aaxg+5hL1pkiSz0xMHc S9Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=bU2TYXI/IQ+ahWPrvtMjvIvPP35LcWsiAJFQ60YWV8o=; b=4itEQnoRkmBEJ3cZ3v7drB28+QEb+74TO/yo7i7RCPL1YQuAbgjf5slQMYCJoSZ4s4 iElCsNOgEd2UrnqAVsoneHn+GFXDgc8ZCTL0bQyn4tuBq4r3h3QF5bKkYHKCsqdV8bbR O/iwCLyp6IyD3ALJEjzj0BjXgUBMLulPQIo/Y3jp9/QnBhzp4UUAgPQCsjKGyVv5Ld6J xBPXY2HOdZEYl6N8M2ioOXJvtp5J2LmmJo7/ITdekXPSLw8OShwoi2FWTdk/ql1kgD4+ YYjCwsUG5g93pjeLrDzH2JXBcetiDTRIuK0qb9GtfhSyditfEwSCHz2Q7oUY/bs840qx V9yQ== X-Gm-Message-State: AFqh2kqak7Vg4yZ8Qi7O1/POQ+4ciIcf3FPZ/zbFP+6NmLI223HLGKDV KNQj8l1pDbMRwahjJki4TQlaWFbFASY= X-Google-Smtp-Source: AMrXdXt3ngSzeTd4BjcWtYkKZUmKlJ+coRJjsu8zn30hseAAXL6r6J79qyIJjR/uVl5OkeApgAgECG74aLI= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:200:9393:6f7a:d410:55ca]) (user=surenb job=sendgmr) by 2002:a25:9f8b:0:b0:705:cde7:2363 with SMTP id u11-20020a259f8b000000b00705cde72363mr8137319ybq.81.1673297640913; Mon, 09 Jan 2023 12:54:00 -0800 (PST) Date: Mon, 9 Jan 2023 12:53:03 -0800 In-Reply-To: <20230109205336.3665937-1-surenb@google.com> Mime-Version: 1.0 References: <20230109205336.3665937-1-surenb@google.com> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog Message-ID: <20230109205336.3665937-9-surenb@google.com> Subject: [PATCH 08/41] mm: introduce CONFIG_PER_VMA_LOCK From: Suren Baghdasaryan To: akpm@linux-foundation.org Cc: 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, laurent.dufour@fr.ibm.com, paulmck@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, axelrasmussen@google.com, joelaf@google.com, minchan@google.com, jannh@google.com, shakeelb@google.com, tatashin@google.com, edumazet@google.com, gthelen@google.com, gurua@google.com, arjunroy@google.com, soheil@google.com, hughlynch@google.com, leewalsh@google.com, posk@google.com, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, x86@kernel.org, linux-kernel@vger.kernel.org, kernel-team@android.com, surenb@google.com X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: E13FE20015 X-Stat-Signature: mi54rua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uxblK+9F8SqmdWiAocGQAjwbsOGfpxRVhnvdorXsuLL0Lc9n3uaA97hQMZBZcLRZ79kmRR4w6FXOBVQijXMBqTok32XZeIWulBhi52cFQ5BRhdp8cgs6YFdj/DSxxsLKgKRyNu6Nsjoi91AynCOnfM7bwn5A98T/2ZmK4VC/FukB8FVswMXbh5ou6fTF/sPsg47Yn95X+uhuIc1AS/Mt1uQfrSccW6JBnnOrMPNFNpCCWj8s84Xyj2ALylpmmK9gPyYjCq2jy7tQsbxhmaZhNOtm+f4T2bdkDDIQh7v2EqHpixjWc1bzCLkcqn5FWAJDxZyqaGcfAB1R4IeERNKW/zeEXRfrZ40QKlRuxOK+iWkfzOxLM X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This configuration variable will be used to build the support for VMA locking during page fault handling. This is enabled by default on supported architectures with SMP and MMU set. The architecture support is needed since the page fault handler is called from the architecture's page faulting code which needs modifications to handle faults under VMA lock. Signed-off-by: Suren Baghdasaryan --- mm/Kconfig | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mm/Kconfig b/mm/Kconfig index ff7b209dec05..0aeca3794972 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -1183,6 +1183,19 @@ config LRU_GEN_STATS This option has a per-memcg and per-node memory overhead. # } +config ARCH_SUPPORTS_PER_VMA_LOCK + def_bool n + +config PER_VMA_LOCK + bool "Per-vma locking support" + default y + depends on ARCH_SUPPORTS_PER_VMA_LOCK && MMU && SMP + help + Allow per-vma locking during page fault handling. + + This feature allows locking each virtual memory area separately when + handling page faults instead of taking mmap_lock. + source "mm/damon/Kconfig" endmenu