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=-2.1 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 26EF6C352AA for ; Tue, 1 Oct 2019 08:36:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DDFB7215EA for ; Tue, 1 Oct 2019 08:36:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="lP0DbysJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DDFB7215EA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5A2EC8E0005; Tue, 1 Oct 2019 04:36:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5549C8E0001; Tue, 1 Oct 2019 04:36:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 46C688E0005; Tue, 1 Oct 2019 04:36:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0151.hostedemail.com [216.40.44.151]) by kanga.kvack.org (Postfix) with ESMTP id 251D58E0001 for ; Tue, 1 Oct 2019 04:36:22 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id AF42C180AD7C3 for ; Tue, 1 Oct 2019 08:36:21 +0000 (UTC) X-FDA: 75994558962.23.deer59_8e9cea1030137 X-HE-Tag: deer59_8e9cea1030137 X-Filterd-Recvd-Size: 5185 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf24.hostedemail.com (Postfix) with ESMTP for ; Tue, 1 Oct 2019 08:36:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=5K/9QqJVpivREjV58AP/sAPQg5ZrzMEPEOt4ul62Gg4=; b=lP0DbysJK6McLudPsgcydWtkA Gu7klEVu2L+gTU+gZRvJiruglVIXRmNEBN78Xlfo0OcLU5pjhio3X21NE9O1bExQZ8KKkEJ9kYq/T QCPtNB+1g26FVVgZ1vLDMFDu3rTEt2ClvQF1F7KyLdsT/6u6RHVhAsG8QID1lQgAX9F2nwjOMdqjx Q3qs3kpEPrXCnkaQI76gkbO9dwOM0SQfTrwgJN7G97yECCd/nBESogDWn1E8Hpby3mz7GYN0l8iTd L1HHawTEFPT67dPyjcI3uGOtPQibnPr6XJVnQFXFx5LuxBLI07+x8t3vHTMGzdcdD4nGzRRDEc21k z96Mkw7nQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.2 #3 (Red Hat Linux)) id 1iFDdf-0002nF-KS; Tue, 01 Oct 2019 08:36:07 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 9D64F301B59; Tue, 1 Oct 2019 10:35:16 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 9C5A4265261AD; Tue, 1 Oct 2019 10:36:04 +0200 (CEST) Date: Tue, 1 Oct 2019 10:36:04 +0200 From: Peter Zijlstra To: Jan Kara Cc: John Hubbard , Michal Hocko , "Kirill A. Shutemov" , Yu Zhao , Andrew Morton , "Kirill A . Shutemov" , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Vlastimil Babka , Hugh Dickins , =?iso-8859-1?B?Suly9G1l?= Glisse , Andrea Arcangeli , "Aneesh Kumar K . V" , David Rientjes , Matthew Wilcox , Lance Roy , Ralph Campbell , Jason Gunthorpe , Dave Airlie , Thomas Hellstrom , Souptick Joarder , Mel Gorman , Mike Kravetz , Huang Ying , Aaron Lu , Omar Sandoval , Thomas Gleixner , Vineeth Remanan Pillai , Daniel Jordan , Mike Rapoport , Joel Fernandes , Mark Rutland , Alexander Duyck , Pavel Tatashin , David Hildenbrand , Juergen Gross , Anthony Yznaga , Johannes Weiner , "Darrick J . Wong" , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v3 3/4] mm: don't expose non-hugetlb page to fast gup prematurely Message-ID: <20191001083604.GM4519@hirez.programming.kicks-ass.net> References: <20190924232459.214097-3-yuzhao@google.com> <20190925082530.GD4536@hirez.programming.kicks-ass.net> <20190925222654.GA180125@google.com> <20190926102036.od2wamdx2s7uznvq@box> <9465df76-0229-1b44-5646-5cced1bc1718@nvidia.com> <20190927123056.GE26848@dhcp22.suse.cz> <20190930092003.GA22118@quack2.suse.cz> <6bba357a-1706-7cdb-8a11-359157a21ae8@nvidia.com> <20191001071008.GA25062@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191001071008.GA25062@quack2.suse.cz> User-Agent: Mutt/1.10.1 (2018-07-13) 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, Oct 01, 2019 at 09:10:08AM +0200, Jan Kara wrote: > On Mon 30-09-19 10:57:08, John Hubbard wrote: > > Well, a couple of questions: > > > > 1. Is there *really* a memory barrier in try_get_compound_head()? Because > > I only see a READ_ONCE compile barrier, which would mean that run time > > reordering is still possible. > > try_get_compound_head() has page_cache_add_speculative() which is > atomic_add_unless() which is guaranteed to provide ordering. atomic_add_unless() only provides ordering on SUCCESS, now looking at the code in question that seems sufficient, so all should be well. Just wanted to let you know that if atomic_add_unless() FAILs there is no implied ordering what so ever.