From patchwork Mon Feb 27 17:36:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13153972 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 D400BC64ED8 for ; Mon, 27 Feb 2023 17:37:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 72B816B0089; Mon, 27 Feb 2023 12:37:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 702F36B0088; Mon, 27 Feb 2023 12:37:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5C9756B0089; Mon, 27 Feb 2023 12:37:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 509476B0087 for ; Mon, 27 Feb 2023 12:37:01 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 347C0AAF8B for ; Mon, 27 Feb 2023 17:37:01 +0000 (UTC) X-FDA: 80513777442.11.4DA5EE7 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) by imf09.hostedemail.com (Postfix) with ESMTP id 5FA5814000B for ; Mon, 27 Feb 2023 17:36:59 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=jatZw+va; spf=pass (imf09.hostedemail.com: domain of 3Our8YwYKCCkXZWJSGLTTLQJ.HTRQNSZc-RRPaFHP.TWL@flex--surenb.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3Our8YwYKCCkXZWJSGLTTLQJ.HTRQNSZc-RRPaFHP.TWL@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=1677519419; 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=ycuncMhySgAqKB0JKjWQ87T3vvxMS9R2K+oLMhIEJ8Y=; b=EwDLLGHnCneHANfZNdAV0RrenU/6ilK2I5eC11ESPVDBWo03GC749XGM5awgz+gDGzvIzg XFreSfdIDITGeq6jSqopeWPDiaLJG16WsGdNz9oJYCn0oGI+PhvlSzITnCsT7etIQ5LwDd 9ixXLcDh9T3pGBH6IMomlZM8DYoZiOA= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=jatZw+va; spf=pass (imf09.hostedemail.com: domain of 3Our8YwYKCCkXZWJSGLTTLQJ.HTRQNSZc-RRPaFHP.TWL@flex--surenb.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3Our8YwYKCCkXZWJSGLTTLQJ.HTRQNSZc-RRPaFHP.TWL@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677519419; a=rsa-sha256; cv=none; b=Xw6Vw1aqvnETQv2FILGiLl1FS90GXalIXpf1d43AkdC1p1n1AYbJcHWuX3hYiYygEnzaWO G4eje7DwVTkSFU+o6YV3qzx58DLwO6ZVS542xh1jRd4OAqm9bAcsWzaHmPhnPz5iIqTbuO NKX/S2dFiSx69erGyZIauyRQ2m5Ytr0= Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-536cb268ab8so154420367b3.17 for ; Mon, 27 Feb 2023 09:36:59 -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=ycuncMhySgAqKB0JKjWQ87T3vvxMS9R2K+oLMhIEJ8Y=; b=jatZw+vavHEldR/zWx4fIqW8wAPU7kuskm2fNsdTmUbEoYYRUK1QgmfSQwty0F7vyh In/5k0Ybu4OL/7+U8XoT4kd5dwj6nkMsSYSfl49SjuU4fWHkZmC7EvE/NA5jUKV5mijt tEPaHMFzYqt7Ecgvi/GqjzXDl7rzKrsdjxUTz3IPQXQFpGFBi+tum9hpbaiwuAQcs7YP AcTg6xqgjkoCojGsNiAv0DLTEBbzq13kS5i64Oy3wTmze25CUcKHKdl0RIiSjO/ZdJhS rd+Ro59v2yktpIygy3VtQ7oiDpWrjQ+HLII3XoEVuOsktTglELO3PMbQ5C9t6zyu7z8h 3t1w== 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=ycuncMhySgAqKB0JKjWQ87T3vvxMS9R2K+oLMhIEJ8Y=; b=bWHtoz26BJGuNwkNbFtr3tY/D4Uf3hVrhShBVspY0yfb3lDLIRAahqelWrk3TVsj7j s/30LPKvSFbwO5ZkwPRx3yE7+VhS8NB0tXC7hDyTpRzKNVYTRDQNz188krSi/iq86qzc Oor052vbU9x0MCf+T/1hvxEypkC3T78gyTFFAjFbofW81w7FzVJ01sSzsuquCArYXk4+ 9hVsMXUIpBLfIu2mkKC/qL/OOW8eW/U2Km3LYJz2RdeNo8q4v2J6AqyNO8coUSw2img5 ikRbm8ZxrCtGvE+mVRLsRc1amkZTMB+00I6MVvF30i4w5Fm+TnJcuu48RpHzGSwZtfo/ k5lw== X-Gm-Message-State: AO0yUKUnM1+haV7e4tBlVC7f5653nSUyU01pZHa49bgCYUVD1xWZ7MFr fl0ppfPVokHbpyfgwgSfzW4DKcjCwLk= X-Google-Smtp-Source: AK7set+sQnwo5grHRclokRwp0C+SftMLAAuN7gXfh+MOPKXwAKaiWwA4Ongifn/fr7bxEOF3Yk7Tuxt7Hwo= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:200:e1f6:21d1:eead:3897]) (user=surenb job=sendgmr) by 2002:a81:af1f:0:b0:52f:1c40:b1f9 with SMTP id n31-20020a81af1f000000b0052f1c40b1f9mr10776885ywh.7.1677519418452; Mon, 27 Feb 2023 09:36:58 -0800 (PST) Date: Mon, 27 Feb 2023 09:36:08 -0800 In-Reply-To: <20230227173632.3292573-1-surenb@google.com> Mime-Version: 1.0 References: <20230227173632.3292573-1-surenb@google.com> X-Mailer: git-send-email 2.39.2.722.g9855ee24e9-goog Message-ID: <20230227173632.3292573-10-surenb@google.com> Subject: [PATCH v4 09/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, 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, gurua@google.com, arjunroy@google.com, soheil@google.com, leewalsh@google.com, posk@google.com, michalechner92@googlemail.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, Suren Baghdasaryan X-Rspam-User: X-Rspam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cL6/6 +0zafySP o/J/ItNlRRdsYV2BEOcZr5fNkqzPqQhEy7Chunc0zIVwbWggzQKKVjDvziHZxUEbmmx+OGsHp/OgqnncXQ0CxGfjfOjv0QHE2zhoUHNsuglzk8mLc9wRpdC6TXP6kKOTnlEy2MzTbwb009etNOA7tOrh6MN39hJZR/OyQ6zD2P1SGJrcEZ/oDA5g6Soc3svrC1XpWSj/IA4oVs8i0pNifOD2n+19rcXKeoIrS0GVhbcO3y30rKuW6uTP3JCp3Bx3iS+QAJz2hFO+1P16YA9op3ODFOwbkfU9sh21XPo0dsOKdjOprHCY3mgxjVrmA8/mRYSQJAng/QNT72N5wOQi+kZOnIlFKYM9Wl+Qj2PgSR4bYk6rFalI6NDc/ykdPJQHM7lIYvYxZxQtZ4HCwDHt9fdqfVRa3s9OAOJNZ2cfJ0WUiJXx3jYvt+szuu0II6mLEGpchXf8rZfBX/RKQqn5iENBY7X/D7n/GX9VU9D/qbjAEgp+drIwWcDVV7krVNIw65EFTRkgIywAzx4bAatjUGDOl4s4xg12yAEb4fmokGSSWJPTuJxREmmhzHxH82nA0v4gI9YJ60BPKvMPO6qI68i/TvBxrWlwe98KubCAJlvhE6eTDnxwmJcMq+vAPpZgSPk4gCyVUlhJsTi7cZMhPOmLe7gIvwI5HzUdCtLXx1oZtR/c= 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: 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