From mboxrd@z Thu Jan 1 00:00:00 1970 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 08230C54E94 for ; Thu, 26 Jan 2023 16:18:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8B9398E0002; Thu, 26 Jan 2023 11:18:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 842558E0001; Thu, 26 Jan 2023 11:18:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6BC8B8E0002; Thu, 26 Jan 2023 11:18:45 -0500 (EST) 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 5C9598E0001 for ; Thu, 26 Jan 2023 11:18:45 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 2D404140976 for ; Thu, 26 Jan 2023 16:18:45 +0000 (UTC) X-FDA: 80397458610.17.C4E641F Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.173]) by imf10.hostedemail.com (Postfix) with ESMTP id 6702EC0011 for ; Thu, 26 Jan 2023 16:18:43 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=H348+fay; spf=pass (imf10.hostedemail.com: domain of surenb@google.com designates 209.85.219.173 as permitted sender) smtp.mailfrom=surenb@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=1674749923; 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=vvEyqxPpR8M4BC65XVopg/XEu9SCivMiAr3QBDUWiyU=; b=cnu/YlGEcCWGNqTXdSE6BdHF7verObAU8iR6ramxF4SShqWPKOczLWtZjbt3rx+e4HTKTo 50NnAlly9Ixo3hQvuKfXKisriScfwTxpORFWwidfbhVfL5KFCMVz0Pn2LkCGKoLyeOcG00 1VMeG0b+mAiLCwdAuyfJXi+swU19WMg= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=H348+fay; spf=pass (imf10.hostedemail.com: domain of surenb@google.com designates 209.85.219.173 as permitted sender) smtp.mailfrom=surenb@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674749923; a=rsa-sha256; cv=none; b=xYWd48ZkFaKWOGwG1zhAbhtmf9rCd2sTFBtk3NSrsLPWXLO/yRYQ5PKDVmYjOJhmucngcB Kqjg3iD+q+y4sNmhQA+SRX5QgaFktjd7iz8jtDJIQYcCGaoZ8g9XrLCCiZspyCHpSzy1qa TJURdziRtyxBp2+Hsa9Gyy1a2zkePfw= Received: by mail-yb1-f173.google.com with SMTP id a9so2597358ybb.3 for ; Thu, 26 Jan 2023 08:18:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=vvEyqxPpR8M4BC65XVopg/XEu9SCivMiAr3QBDUWiyU=; b=H348+fayL/o7ZK4OMOl0X4WP2eMya1R6g3s71mVa0DA8XCsYAD7Mno2OaEE7NA0CmO e4033coOL787sHvi/S6s9OFvGkRHoLaUuJ1duFsKOvl5kj/wYF8+5cRX76ijn0+r9mVN /MK6vYc4x8jCg28wjYXYjcmydOgZp19VGDCnfGGlA3w2bC3Yw6+bgXPCcc6kwlaa/Dld Xkvgt3oautRKkhJGYhlwnO6TvcpaegDMiJu4G7chvMyMJzFUHGEi5AWj6fisELCIR8Mt LiDJG1ULptGXP+W67GIwNcq68sjgGTmxbYOeP0BP5KnuDIfe/tA0SCD/oII/g1WHFURW dp6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vvEyqxPpR8M4BC65XVopg/XEu9SCivMiAr3QBDUWiyU=; b=w/ScGxoMNpeWkaO0f7mcTps+MHSlOuVJu8I8Q2JQlynNxKPOXphd2711FobFUvaDXK fjcGSqsvqHf6dRTgsguG1INe7aTmUKl2XZ57QelZ4coQ3wgfZ6MCJcq8W3fd5Mjga2JU AHQSK6GZAn53FnyuAsUtVVb8A9mcp6dF/WnawYloeeUJpbSfzoIuSn/4Tr3JtFpJO55e PCKz4gJzeE7oyu7uv4W+UgrFdTAahgCuA5Yhobf8WjCF5aAWLi6+OOCZ6MFAhr6Sc4mf djcmffd4Q3O1PiFujJHngLVez2oDmc9nj6YYAg9fmlmn+VCO++jpG9r03FSBRkgvEix+ Mwfw== X-Gm-Message-State: AO0yUKXJzlK7fekdFsquvLJu5B8ONxsTTdpxaLwhizziyFz4v9wujlun JRCXgK7bk7mbmZ53n1Btry3g0w+VxhzUl8k8gHBr8w== X-Google-Smtp-Source: AK7set9P+5mtUtKJMZFiPeuyZhPr8TwEdg7FU3uDJVhz4F2UDpdSR6q0zVgkPPrpoaJxmCX2P+Pz2XDq0fuB0xLwifk= X-Received: by 2002:a25:6811:0:b0:80b:c92b:ed7c with SMTP id d17-20020a256811000000b0080bc92bed7cmr466120ybc.593.1674749922312; Thu, 26 Jan 2023 08:18:42 -0800 (PST) MIME-Version: 1.0 References: <20230125233554.153109-1-surenb@google.com> <20230125233554.153109-7-surenb@google.com> <20230126154740.j3a3lu4x557c56yi@techsingularity.net> In-Reply-To: <20230126154740.j3a3lu4x557c56yi@techsingularity.net> From: Suren Baghdasaryan Date: Thu, 26 Jan 2023 08:18:31 -0800 Message-ID: Subject: Re: [PATCH v3 6/7] mm: introduce mod_vm_flags_nolock and use it in untrack_pfn To: Mel Gorman Cc: akpm@linux-foundation.org, michel@lespinasse.org, jglisse@google.com, mhocko@suse.com, vbabka@suse.cz, hannes@cmpxchg.org, 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, 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 Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 6702EC0011 X-Stat-Signature: nmmmg774brjrh5yzhu9j33wttiuteb8o X-Rspam-User: X-HE-Tag: 1674749923-483509 X-HE-Meta: U2FsdGVkX1+KVj7smZpBnoUi66ZvQru7XtQIL3edglUPg1UomVaaIYai+Vwi0dT8hxDV5kuqp5YM837nnvQiMoq+QkceQMiL3/kx9kqmtWKziDICQuASTQTDtAQo+5UHQz6r4ENALIaUU9Wmgfs8g5e74r8vbDSh9kDVmrFBU0WvEwaX/ERNhcQ82tX4PV8beAXIuT1HWBXBXqpnlLw17he0K5+m/PB3snHA95QRo68PxWQI4iocqBPe2AyGhs+UdY7mGhwOsA+3cvvwcu230C7XJH/Aw4+aJsZVMmm3bJZYK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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: On Thu, Jan 26, 2023 at 7:47 AM Mel Gorman wrote: > > On Wed, Jan 25, 2023 at 03:35:53PM -0800, Suren Baghdasaryan wrote: > > In cases when VMA flags are modified after VMA was isolated and mmap_lock > > was downgraded, flags modifications would result in an assertion because > > mmap write lock is not held. > > Add note that it's also used during exit when the locking of the VMAs > becomes irrelevant (mm users is 0, should be no VMA modifications taking > place other than zap). Ack. > > The typical naming pattern when a caller either knows it holds the necessary > lock or knows it does not matter is __mod_vm_flags() Ok. It sounds less explicit but plenty of examples, so I'm fine with such rename. Will apply in the next version. > > > Introduce mod_vm_flags_nolock to be used in such situation, when VMA is > > not part of VMA tree and locking it is not required. > > Instead of such situations, describe in as "used when the caller takes > responsibility for the required locking". Ack. > > > Pass a hint to untrack_pfn to conditionally use mod_vm_flags_nolock for > > flags modification and to avoid assertion. > > > > Signed-off-by: Suren Baghdasaryan > > Patch itself looks ok. It strays close to being "conditional locking" > though which might attract some complaints. The description seems to accurately describe what's done here but I'm open to better suggestions. Thanks! > > -- > Mel Gorman > SUSE Labs