Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp994194pxb; Tue, 3 Nov 2020 19:20:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJznd32/kdLRaKCMDKyCJIDM1Nl2du91/BYv4TnrswUbobbFjN2WLlD9hYuzxnmC9io5sbXO X-Received: by 2002:a17:906:8282:: with SMTP id h2mr18272720ejx.50.1604460056876; Tue, 03 Nov 2020 19:20:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604460056; cv=none; d=google.com; s=arc-20160816; b=Psz+ahBO53v3QMMHrcmv0Sc94YZaBqH6TJhLRORm2fIlikA/azY2+UFQNsOUEPe+9f Pzc30iicJZC+WRr9TxMZqMBKHaQrr1/FaSCWeCtJN18LP+qsOEzcqZq/pIweiCgtx0pe o887wJvWEhZ3INS0JLXLW0Kc6j6/kMqCrAhsTOkWICBT5nkIw03MTrunB2Jr9xWy/KWy 81AZmlnhDLkDjLQfAbXyAkDLrQUNz85s6nv96jV1pyNLvm7mrMXGFooRrpRlOwWMnWyR WRJR5jh2SPlONgBtmuoLYapNKeAeYjtsA32uNukyTiq7WvJU3KHXc3k8hTXaFP6lWJ1J a8Nw== 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:dkim-signature :dkim-signature:date; bh=3bH5n5uofGlK83e8+oI2etgYM3sHhSJQ2RmcQs9aKcg=; b=fSU/mWfITLl+uz2WWsMSNms8mPHxIC6l7rqifaDfFdEH+vMD1hszd3EHrA/MZobHrw WwS/5cJYX0o777WQZT/XvQRLFhQVE8dRTpzNJw9Ip9a3lk2Pvf59RZnmrp94r8/iA5qD OIx8pR8prUadgdoBcL6ZFY37NYsZR3LPpUTQ7owWxq6sBgr+t+ppjisTZkYZdKcRW2eC apKBmorj/2fbuZ7sinp4xKDYsMUdqnatpocGqlpINkP46QYQL8O4OOa39Mfnq39ekNXZ 9ku68QKL1sr8icDftBwkUYv1bHveu19fz54PXPKcXzEkgKDHe2pKj08IoG+I2pbQIySA yxdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=DJnH97AX; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t9si415706edw.355.2020.11.03.19.20.34; Tue, 03 Nov 2020 19:20:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=DJnH97AX; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729874AbgKDDRQ (ORCPT + 99 others); Tue, 3 Nov 2020 22:17:16 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:46526 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728759AbgKDDRP (ORCPT ); Tue, 3 Nov 2020 22:17:15 -0500 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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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