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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8591EC54E94 for ; Thu, 26 Jan 2023 00:25:21 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4P2M1C6LBGz3fC2 for ; Thu, 26 Jan 2023 11:25:19 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=yBfgnLWE; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux-foundation.org (client-ip=2604:1380:4641:c500::1; helo=dfw.source.kernel.org; envelope-from=akpm@linux-foundation.org; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=yBfgnLWE; dkim-atps=neutral Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4P2M085ydFz2yRV for ; Thu, 26 Jan 2023 11:24:24 +1100 (AEDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5518F616EE; Thu, 26 Jan 2023 00:24:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B02CC433EF; Thu, 26 Jan 2023 00:24:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1674692661; bh=N0v5l5ZR0YrLLuXkW8rcRAmrAzQT9ot2bUDRvREIlOA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=yBfgnLWERC7RJfGt+Vcyq9ihgxPtUxN5ZDIv9T78iTGUTZ2aEZOryZgFk1X9EdABl lrQiE4BNvEpCbVdhotoGo5aDtCNiXOfu0mPz54AqvHfY+yWZf+Nd9ue7sLNvJjNzgQ WOOjjg1+ziaccQFgXs89KnsVW3vxyXi02Y4i5DoA= Date: Wed, 25 Jan 2023 16:24:19 -0800 From: Andrew Morton To: Suren Baghdasaryan Subject: Re: [PATCH v3 2/7] mm: introduce vma->vm_flags wrapper functions Message-Id: <20230125162419.13379944d6c0d4253d7bc88c@linux-foundation.org> In-Reply-To: <20230125233554.153109-3-surenb@google.com> References: <20230125233554.153109-1-surenb@google.com> <20230125233554.153109-3-surenb@google.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: michel@lespinasse.org, joelaf@google.com, songliubraving@fb.com, mhocko@suse.com, leewalsh@google.com, david@redhat.com, peterz@infradead.org, bigeasy@linutronix.de, peterx@redhat.com, dhowells@redhat.com, linux-mm@kvack.org, edumazet@google.com, jglisse@google.com, punit.agrawal@bytedance.com, will@kernel.org, arjunroy@google.com, dave@stgolabs.net, minchan@google.com, x86@kernel.org, hughd@google.com, willy@infradead.org, gurua@google.com, mingo@redhat.com, linux-arm-kernel@lists.infradead.org, rientjes@google.com, axelrasmussen@google.com, kernel-team@android.com, soheil@google.com, paulmck@kernel.org, jannh@google.com, liam.howlett@oracle.com, shakeelb@google.com, luto@kernel.org, gthelen@google.com, ldufour@linux.ibm.com, vbabka@suse.cz, posk@google.com, lstoakes@gmail.com, peterjung1337@gmail.com, linuxppc-dev@lists.ozlabs.org, kent.overstreet@linux.dev, hughlynch@google.com, linux-kernel@vger.kernel.org, hannes@cmpxchg.org, tatashin@google.com, mgorman@techsingularity.net Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Wed, 25 Jan 2023 15:35:49 -0800 Suren Baghdasaryan wrote: > vm_flags are among VMA attributes which affect decisions like VMA merging > and splitting. Therefore all vm_flags modifications are performed after > taking exclusive mmap_lock to prevent vm_flags updates racing with such > operations. Introduce modifier functions for vm_flags to be used whenever > flags are updated. This way we can better check and control correct > locking behavior during these updates. > > ... > > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > +static inline void init_vm_flags(struct vm_area_struct *vma, > +static inline void reset_vm_flags(struct vm_area_struct *vma, > +static inline void set_vm_flags(struct vm_area_struct *vma, > +static inline void clear_vm_flags(struct vm_area_struct *vma, > +static inline void mod_vm_flags(struct vm_area_struct *vma, vm_flags_init(), vm_flags_reset(), etc? This would be more idiomatic and I do think the most-significant-first naming style is preferable.