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 X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 675A6C388F2 for ; Wed, 4 Nov 2020 03:17:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C480F2242A for ; Wed, 4 Nov 2020 03:17:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="DJnH97AX"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="fQ+G3bXH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C480F2242A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CBFBF6B0036; Tue, 3 Nov 2020 22:17:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C4CDE6B005D; Tue, 3 Nov 2020 22:17:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B12496B0068; Tue, 3 Nov 2020 22:17:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0008.hostedemail.com [216.40.44.8]) by kanga.kvack.org (Postfix) with ESMTP id 814356B0036 for ; Tue, 3 Nov 2020 22:17:16 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 176578249980 for ; Wed, 4 Nov 2020 03:17:16 +0000 (UTC) X-FDA: 77445274872.29.cough05_5a10039272bd Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin29.hostedemail.com (Postfix) with ESMTP id E58A618086CA5 for ; Wed, 4 Nov 2020 03:17:15 +0000 (UTC) X-HE-Tag: cough05_5a10039272bd X-Filterd-Recvd-Size: 4611 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Wed, 4 Nov 2020 03:17:15 +0000 (UTC) Date: Wed, 4 Nov 2020 04:17:11 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1604459833; h=from:from:reply-to:subject:subject: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=3bH5n5uofGlK83e8+oI2etgYM3sHhSJQ2RmcQs9aKcg=; b=DJnH97AXqvOcoZtXhyJWk/S7fnDW66YKb/wkCVoGdnriRevjBoy6Vf4q32UKeFDkkYuijp IZCBU/HM7eHsMsjnS6c99TQ74CH4k+fnSs8YGfvP5Ot3uyftqpYncG34N+Z28Dn/JZdlu0 yeOeZBzAhGRFP4uRCVsggFhOlEDdVMtuLXYhVHmSJVoIOUoIJmzVKH95RbXEJDUtmdkYMh YlW8rIgPnNPQSS5/mCQUddLljHpmKLNaUnRrQrH2/uZp2Icv/KyLE7G5vq3EkprrDpW2v7 gxDLkKh8eJLhQk0DGot18z+P4J/w+m9rUBtodY6bRm6oWta0J2T0WhkRJo2u8Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1604459833; h=from:from:reply-to:subject:subject: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=3bH5n5uofGlK83e8+oI2etgYM3sHhSJQ2RmcQs9aKcg=; b=fQ+G3bXHhsEC3Byj/uV3DZxxLN9/4FUOgt5WyqFKGn+44u+RKFgzxD+5qV0gwBEGONs9o7 JKsixHNRyWFhWVAg== From: "Ahmed S. Darwish" To: John Hubbard Cc: Linus Torvalds , Jason Gunthorpe , Peter Xu , Linux Kernel Mailing List , Andrea Arcangeli , Andrew Morton , "Aneesh Kumar K.V" , Christoph Hellwig , Hugh Dickins , Jan Kara , Jann Horn , Kirill Shutemov , Kirill Tkhai , Leon Romanovsky , Linux-MM , Michal Hocko , Oleg Nesterov , Peter Zijlstra , Ingo Molnar , Will Deacon , Thomas Gleixner , Sebastian Siewior Subject: Re: [PATCH v2 2/2] mm: prevent gup_fast from racing with COW during fork Message-ID: <20201104031711.GA227990@lx-t490> References: <20201030225250.GB6357@xz-x1> <20201030235121.GQ2620339@nvidia.com> <20201103001712.GB52235@lx-t490> <20201103002532.GL2620339@nvidia.com> <20201103004133.GD52235@lx-t490> <20201103065225.GA63301@lx-t490> <20201104013212.GA82153@lx-t490> <29e4f7f7-5774-7d8f-694b-75eb55ae1b2e@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <29e4f7f7-5774-7d8f-694b-75eb55ae1b2e@nvidia.com> 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: On Tue, Nov 03, 2020 at 06:01:30PM -0800, John Hubbard wrote: > On 11/3/20 5:32 PM, Ahmed S. Darwish wrote: ... > > #define __read_seqcount_retry(s, start) \ > > - __read_seqcount_t_retry(__seqcount_ptr(s), start) > > + __do___read_seqcount_retry(__seqcount_ptr(s), start) > ... > A nit: while various numbers of leading underscores are sometimes used, it's a lot > less common to use, say, 3 consecutive underscores (as above) *within* the name. And > I don't think you need it for uniqueness, at least from a quick look around here. > ... > But again, either way, I think "do" is helping a *lot* here (as is getting rid > of the _t_ idea). The three underscores are needed because there's a do_ version for read_seqcount_retry(), and another for __read_seqcount_retry(). Similarly for {__,}read_seqcount_begin(). You want to be very careful with this, and never mistaknely mix the two, because it affects some VFS hot paths. Nonetheless, as you mentioned in the later (dropped) part of your message, I think do_ is better than __do_, so the final result will be: do___read_seqcount_retry() do_read_seqcount_retry() do_raw_write_seqcount_begin() do_raw_write_seqcount_end() do_write_seqcount_begin() ... and so on. I'll wait for some further feedback on the two patches (possibly from Linus or PeterZ), then send a mini patch series. (This shouldn't block a v3 of Jason's mm patch series though, as it will be using the external seqlock.h APIs anyway...). Thanks, -- Ahmed S. Darwish Linutronix GmbH