From patchwork Fri Jan 27 19:40:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13119251 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 615E4C38142 for ; Fri, 27 Jan 2023 19:41:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 487DD6B0085; Fri, 27 Jan 2023 14:41:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 437306B0087; Fri, 27 Jan 2023 14:41:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 269E86B0089; Fri, 27 Jan 2023 14:41:46 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id F1DEA6B0085 for ; Fri, 27 Jan 2023 14:41:45 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id B96B21C6084 for ; Fri, 27 Jan 2023 19:41:45 +0000 (UTC) X-FDA: 80401598970.04.6B42CED Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) by imf25.hostedemail.com (Postfix) with ESMTP id 041BDA001B for ; Fri, 27 Jan 2023 19:41:43 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=m4Wtor8v; spf=pass (imf25.hostedemail.com: domain of 37SjUYwYKCLQmolYhVaiiafY.Wigfchor-ggepUWe.ila@flex--surenb.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=37SjUYwYKCLQmolYhVaiiafY.Wigfchor-ggepUWe.ila@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=1674848504; 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=pFZiiTJ1lM5Y9cE9VJMMN6c4zys62lyfuQWFB/SvSfY=; b=V+XTWC06Mf+LwjKwe8r9fW3Lz9l7d3ZzkZag4w+uXD9UdqvfWjC2I4svwRSQzy33pE2buA tXDNvXFbDVMOCRyUOqtmzI3iijJk08gprYTOOpp8/vKJLnuQ7407vJLv5jqGV53cTwf2Kn acPYkz7qG/EPcDcwQ6GR0+2qfGtFI2I= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=m4Wtor8v; spf=pass (imf25.hostedemail.com: domain of 37SjUYwYKCLQmolYhVaiiafY.Wigfchor-ggepUWe.ila@flex--surenb.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=37SjUYwYKCLQmolYhVaiiafY.Wigfchor-ggepUWe.ila@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674848504; a=rsa-sha256; cv=none; b=zevJuxbX48bkzYxZLEr0sbIApPmqsZYWVmCP+Ev2CfIOxMLWY1fEcWpc7EKw9a4lb30Jy6 /U88+cdOKd7MdVlqg0ArtC50WqfLa4ntuiZfEKSijuxqG1f7vE2+dqrg0uIUzYd8ZO8xV0 b5bAQex3kejTzVt/heU/+Pn8r3RZzLg= Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-509ab88f98fso56707977b3.10 for ; Fri, 27 Jan 2023 11:41:43 -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=pFZiiTJ1lM5Y9cE9VJMMN6c4zys62lyfuQWFB/SvSfY=; b=m4Wtor8vj3J0ycRC6QGu22LySA+n2MGlbf/sH76T8N8Pnp/d8SuPXb/kR+Hyj37+ad 48NkH1zhtbcV3yGPaiQ5KPXnB06jsyj37BRmFZaU4H+LJ2YSwMP7BoYjL006YrtxIZWR VsSyGQhSW7cL19AuEXNwVKmULWycfkr7kU4POPAgtbT6hDzlZniUKpxVu1Hu98jAvRgz bcxq0t9OKK2J7/3O0lRl4dNTg073Sp+ojK3rnWcxuyGW0RvPh9anMnsNc+W5/rLzSMsJ Ho/St/2m0p0zsIWZF5QsNOVQeuQXkfsBP43+XpjCQzZI9euWanUB/WzPnytDjlkSAgXd IXOQ== 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=pFZiiTJ1lM5Y9cE9VJMMN6c4zys62lyfuQWFB/SvSfY=; b=GurcPao/o9qZTJQ7LuM1DBKCuwb+itq/xYnCpo6iPqR3DpDcNDcYvbaOtROqV9Ew5y F/bAj+JAnYanxu0AyAk/NzUxEvEDUNtT0qbzOkvazDmrw2GTjxkkeYvdVKfQc+l+hXHF mXZoVWRYGtCbYIctuQmhpWP0izeFwz/BtWoto92KyMZ5Jq4i2DcrAmeAvBus+LeJxzhZ /6droS83aISR17tQ8dCSq2lLt6Cjq4t9XWAgVHBAYswDRwF+h+3eckjl0IpSa69DnYuk FvDZ3+81CHUS/G+sr2s1G/CjCkfb1j7jASqw3e5OEbI4yePNYCtVloASZS6HfuPsm7EN yiuA== X-Gm-Message-State: AFqh2kpEvKPFgfyPGHByZgvD2/aRPhzXvRWdoJFcLAh0iCZZRihQitQt 35yK0emoksJKZ3tbEgJOPN+QGDWBq+w= X-Google-Smtp-Source: AMrXdXt7ky1YKmCHrEvdSmppryHuxdZmy/ExGSeixqws3R/QJJ6NNyUiC3cubRusLU6Amdx/dq1XzZif1cI= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:200:4e19:be9:c5d0:8483]) (user=surenb job=sendgmr) by 2002:a81:1d47:0:b0:3f4:6c62:18d1 with SMTP id d68-20020a811d47000000b003f46c6218d1mr3383963ywd.491.1674848493581; Fri, 27 Jan 2023 11:41:33 -0800 (PST) Date: Fri, 27 Jan 2023 11:40:45 -0800 In-Reply-To: <20230127194110.533103-1-surenb@google.com> Mime-Version: 1.0 References: <20230127194110.533103-1-surenb@google.com> X-Mailer: git-send-email 2.39.1.456.gfc5497dd1b-goog Message-ID: <20230127194110.533103-9-surenb@google.com> Subject: [PATCH v2 08/33] 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, 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, 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, gurua@google.com, arjunroy@google.com, soheil@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: 041BDA001B X-Stat-Signature: uwzar5fz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orTqOiFbGnxmMvH7NIt/xnQciGJtFHQVFaQnxhg/LOBRhXYOtSBZC1FLIYFHXi6C+kFnN6TyTSVy0qBPjmfBOJkayJnSdqAAIUjDM2czxnEaeaEt3z+8d5pP6soAgjPsiJOa+BYtNY2sTTuBVmuYEgwdp/wX5C/JSWAI6bQ61GC2ole9hHJc/PnyIT2BXcAqjTqPIChSNS1ojykd9axfDYd1B/AhM6AbesJ7onUA1OzDikJXPeK/9I6fJBcTEDd2kTnm8amYTIsAgHX15FdRHLJ/7L9lfU2H2kGbUN5nPdsNT4LQQH9hMYImUOXQwZCZRPmqlgCQKJz7NVDUItFxShunpzOzjAAFB1LAtmnwH8q9/ggTYzgUMp99934o7919dlru+CNhgi3hWJ1VVXKom29jkoEeMWbU47Vhqsj2ZdxWuj/3rMu14iPwdOKNK2HMrw6/bhRZsD6cTk0wZs5gQmMUFxN6bT2habPVLE2tmZmml2IAPJzyNlHnkIUdcglM1xoNQFI9su2K9/3DUu1LCe52uXzAxyQwRG7T5nnOsyPDwQKq0z/2Dg07q8OPq+BXBHGBunVlHr+5LSqAV1m0jRwb7RtgepRtrckVkdqbVJyUSS2jJ2hPAk8mcjYPYOv3zn0M= X-Bogosity: Ham, tests=bogofilter, spamicity=0.001286, 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 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 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mm/Kconfig b/mm/Kconfig index ca98b2072df5..2e4a7e61768a 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -1211,6 +1211,18 @@ 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 + def_bool 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