Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp685243pxk; Thu, 3 Sep 2020 09:59:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzXKsCZfwx+bmmzF6P9qLX6u1eAI5bPmh98ZLeTOVnqC280Ib5wlgxOiHzTuCwgffV91NH X-Received: by 2002:a50:fc04:: with SMTP id i4mr4164539edr.14.1599152371093; Thu, 03 Sep 2020 09:59:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599152371; cv=none; d=google.com; s=arc-20160816; b=AUgzNiT+ocO5bgkp2UtedOUVDPTic14WPpI2vn1zJXn4vq7n9aUvSPDliMHoSN48OM W4K4XtElpIFfx9t6KICjzsqmwxMCjgwegfkX788Fo7+69Qf5j3JJjoOtoUgZvfZLQ30C H3jkzj4G8UBeJ/3Z7LnX4f/T0IqVrfhj2T4SaFIJYJ71+GFkKdLL5WNok/M/p0I9ldTB r3PJSdBFvr+lrMaio7J2/fNa84UmeUzYS8NXov6NHawE3Uv9UaF9Q3OlIVyd2dtMrcgx OlrduFTFkeltyKZvG4P4IrZCBbRejYuyCvyQaaHsgj5dpc8kYaz6Sp7tRhq/0enAInAj JaBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=/1m8FD1Bq3sHl8yu7KCZle+Y3qYoxUKr4gtXUdv0gU0=; b=ezJKD5N1sQZ7Sp7ZVq+cGgUc3yUR8rimfRpTPFL5N6bKTPzCt1Am3w0S6StrBMl8pX gPWZ4Mj4hTfx4kNLU+g1xT8tO8lOIZtSFxxWvuGCH1MU77Yv0U1EOGrLt01VJaAvQ2qX AQWyzqQ2IRL6Kgx6vD18GtiQ+yYrKKP2CtNTBeTwhStOFIanqJZyA6wiKdXpJZ7h2vER JYi+fpJWcvVzZr/OMbJuuhP260qpWv36HxFSnOXMIP44oLw2KQWNwv2/dCT5/0i/8eav NO15xbF9qSIegxFj2i98cZlxHnfagQW/ElvKaJzyyWsHrvSnXtr23T6NNiq7zrhBeZ0x w91w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=K4bZxN0z; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c5si2212473ejs.330.2020.09.03.09.59.07; Thu, 03 Sep 2020 09:59:31 -0700 (PDT) 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=fail header.i=@infradead.org header.s=casper.20170209 header.b=K4bZxN0z; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728417AbgICQ4T (ORCPT + 99 others); Thu, 3 Sep 2020 12:56:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726327AbgICQ4R (ORCPT ); Thu, 3 Sep 2020 12:56:17 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29AE9C061244 for ; Thu, 3 Sep 2020 09:56:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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; bh=/1m8FD1Bq3sHl8yu7KCZle+Y3qYoxUKr4gtXUdv0gU0=; b=K4bZxN0zw+2ODOI2cR/HKfTdze iSDfdYhJwVooo4MfVxihgS9MLK05R8QxClTPDRG9vku7evCr0Mt8/9+qe5wSJXWWNxuBRR8deu+VH rETQn4cRd2SjZ22XhUAc3cK+7OKfNF9Tgn9rnizYPrA/JZ5Eoz5hodDM5LSiZrewZE5bhKxP0Jwoh eSy8ejsJy7ANqnPWvse0/hS2+VoaHh2013j6V30h/yIVBrzDVYpqnft2cNga0C5n/DMnLHs2MJzFA tZ2xMGZ3qfF6xkfs5OO0z4r2S1uecvdU2BoBPIhut/5KNaGg7wvlWw5O48+ZL3iplW+P/aDCi+gNc Jnn3KPtg==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kDsWl-0006eQ-PQ; Thu, 03 Sep 2020 16:55:59 +0000 Date: Thu, 3 Sep 2020 17:55:59 +0100 From: Matthew Wilcox To: Jason Gunthorpe Cc: Zi Yan , linux-mm@kvack.org, Roman Gushchin , Rik van Riel , "Kirill A . Shutemov" , Shakeel Butt , Yang Shi , David Nellans , linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 00/16] 1GB THP support on x86_64 Message-ID: <20200903165559.GD14765@casper.infradead.org> References: <20200902180628.4052244-1-zi.yan@sent.com> <20200902184053.GF24045@ziepe.ca> <20200902184852.GH24045@ziepe.ca> <20200902195739.GI24045@ziepe.ca> <20200903164032.GM24045@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200903164032.GM24045@ziepe.ca> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 03, 2020 at 01:40:32PM -0300, Jason Gunthorpe wrote: > However if the sizeof(*pXX) is 8 on a 32 bit platform then load > tearing is a problem. At lest the various pXX_*() test functions > operate on a single 32 bit word so don't tear, but to to convert the > *pXX to a lower level page table pointer a coherent, untorn, read is > required. > > So, looking again, I remember now, I could never quite figure out why > gup_pmd_range() was safe to do: > > pmd_t pmd = READ_ONCE(*pmdp); > [..] > } else if (!gup_pte_range(pmd, addr, next, flags, pages, nr)) > [..] > ptem = ptep = pte_offset_map(&pmd, addr); > > As I don't see what prevents load tearing a 64 bit pmd.. Eg no > pmd_trans_unstable() or equivalent here. I don't think there are any 32-bit page tables which support a PUD-sized page. Pretty sure x86 doesn't until you get to 4- or 5- level page tables (which need you to be running in 64-bit mode). There's not much utility in having 1GB of your 3GB process address space taken up by a single page. I'm OK if there are some oddball architectures which support it, but Linux doesn't.