Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp4965657rwb; Tue, 17 Jan 2023 07:36:04 -0800 (PST) X-Google-Smtp-Source: AMrXdXvyXpFc5yGbIjweQdpRSd8601Ddv7jtB3EZ9lAH6yz+xwfCoALJrJ8QU/fVAVf8vUhT20YW X-Received: by 2002:a05:6a00:1d9f:b0:58b:6284:779e with SMTP id z31-20020a056a001d9f00b0058b6284779emr4585658pfw.11.1673969764368; Tue, 17 Jan 2023 07:36:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673969764; cv=none; d=google.com; s=arc-20160816; b=ZXqzipFqoaSOXCpGNOl4aE3pV/INWJcasEy//9AmrcFUVCcCB/vc9vowqeT7Uw/d+Y di/8ECEK7XPdzW4x+bIB/dJFsKhr0RjcUT36JBDC/Fh06vjlSlk0KvOTKazBbRZfPDzK xwCO3SY7mBYr2JUJpgvBnmX7QblvOBYrDTZ+FrfviaPbMsQagOLrl1RH+jefVc83D/vz cfx6lFMc86DGG/jlL4CQb6v6iy0v/JFvjXStEb4zWRIpX29SaLZgQXh+g5AHY59seEMi W2ayTDJOfGcdlsM95+rLeOAicGH1RHAu33T4ev89xhU/Hw0d31pgmNr2D7/gWVXlLwx1 vYzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=6V2VZScsK1ZinrFEkqeTShIOGmI+xaJW7bwy0e3iVQY=; b=KKYxQAP7VS0af68T+yabO53PiB1p67rVktEn37IZZr4eirMqhQxn5bh+FuLYZh9zFq Mx2z7mB23wmqJYE/MfiXNjeRtiITkv3uq6vTfF9llU9T0tIYtUDIMdoJeCEyQp7nMJF2 EAJ7ddTEIGm66ZKZHYTg4CobXGzzX3aPdD1JsqewDd9OEA3wUGjtraC2hF6VlMz0V9dJ jrMA1p3qN9LKv8uxFUAbay8OpypcN72KjwuKHiIFp4xUUUxYdK5AszhelAsfKyaTTJ30 JVFbsFJ7o2RO51BdPrNZoCOvQ+yH7QeLYnMT4gCZ8TW6YUl6PkgWiTA7Gvvsyuyu87gl NAjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=cu4sHORQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m19-20020a056a00081300b005871ef7e13csi8951187pfk.46.2023.01.17.07.35.58; Tue, 17 Jan 2023 07:36:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=cu4sHORQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231358AbjAQPHI (ORCPT + 48 others); Tue, 17 Jan 2023 10:07:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231436AbjAQPHG (ORCPT ); Tue, 17 Jan 2023 10:07:06 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D4A43D0AF for ; Tue, 17 Jan 2023 07:07:04 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 471FF387B0; Tue, 17 Jan 2023 15:07:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1673968022; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=6V2VZScsK1ZinrFEkqeTShIOGmI+xaJW7bwy0e3iVQY=; b=cu4sHORQXjae9Ocu+lNNPo3B8A8fwUGA+VendakuJSRO/eyKhJlFGYg7kizcQyieCvMQKz 38OljQbTlXpq9rWbtxC5hv0r+dOHwobThPzg7YhhnfcZpM/ZKBHfejYRDWJkMH48o3cKue jQuECbg6F9zy5e35mX4Zd4yCM0dwbvQ= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 1396B1390C; Tue, 17 Jan 2023 15:07:02 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id V/U+BJa5xmNuQAAAMHmgww (envelope-from ); Tue, 17 Jan 2023 15:07:02 +0000 Date: Tue, 17 Jan 2023 16:07:01 +0100 From: Michal Hocko To: Suren Baghdasaryan Cc: akpm@linux-foundation.org, michel@lespinasse.org, jglisse@google.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 Subject: Re: [PATCH 12/41] mm: add per-VMA lock and helper functions to control it Message-ID: References: <20230109205336.3665937-1-surenb@google.com> <20230109205336.3665937-13-surenb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230109205336.3665937-13-surenb@google.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 09-01-23 12:53:07, Suren Baghdasaryan wrote: > diff --git a/kernel/fork.c b/kernel/fork.c > index 5986817f393c..c026d75108b3 100644 > --- a/kernel/fork.c > +++ b/kernel/fork.c > @@ -474,6 +474,7 @@ struct vm_area_struct *vm_area_dup(struct vm_area_struct *orig) > */ > *new = data_race(*orig); > INIT_LIST_HEAD(&new->anon_vma_chain); > + vma_init_lock(new); > dup_anon_vma_name(orig, new); > } > return new; > @@ -1145,6 +1146,9 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p, > seqcount_init(&mm->write_protect_seq); > mmap_init_lock(mm); > INIT_LIST_HEAD(&mm->mmlist); > +#ifdef CONFIG_PER_VMA_LOCK > + WRITE_ONCE(mm->mm_lock_seq, 0); > +#endif The mm shouldn't be visible so why WRITE_ONCE? -- Michal Hocko SUSE Labs