Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp54493rdb; Thu, 16 Nov 2023 11:42:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IFlmNTQmnMujfcQioTHIj2mdPWHkNZIKW6ZKuQPu+AGqapXoH21yGJutaV2ChCDJCSD2cNV X-Received: by 2002:a17:902:6ac4:b0:1cc:5296:10e4 with SMTP id i4-20020a1709026ac400b001cc529610e4mr9010323plt.22.1700163725707; Thu, 16 Nov 2023 11:42:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700163725; cv=none; d=google.com; s=arc-20160816; b=fkEQA3L/As8V3quXiEF6b/uHM2UGZ7ictDyYASy2mYVYH828+1Ln7CBrU5RPg5d2iP sl8F1bKiH7FgxDoEhWFDFSKY0ssPmPeGdDzargvus/OsLiD9A6PF2G3PlNiisYMtqB6H CsKsYQeLUrjDqKy8D2mJBinCSNuk5Tye4RZHcSWP2FiftJ3k8NSwipX/1AtuXKpotoei UURwlsmiQ4N76htNX0hFKdNrjzVL9u5U5bNF2L1yNeyk54BAsv4kRwgh7vYZlEIMXARf WrgALIo63N6MhcmBWWKskzCLl+K8ZIMKp4tetH2MgP9z1mtObgSxHzKcGjMi7z0pEiLq 5OcQ== 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=ri1OUYfeB6un/pQ9MDSMKyqtm4r6z514s2TDXJOWFn4=; fh=rDR6uQTqWpPmO4DS/GwgrKElb15Kny2Oz8UTckqjuDk=; b=iEJDX2phZrEMlAfREqJVGi4z9b8N6YBYVs7fsuaX4UTmjmg7ZHCHelz07j5m4+r8u/ J/Rx9QmmvHeeoaaUqX9VFsOv0/jWv/S8ZeLLjdTfaRSAGvNY4I/z7d1BxwWbsfK11d52 A29cmoKOHCQAouyLYhV/7l73qJa0FeI36acyOjGigLu3hQOMIGe0/YBKL0DC25QVke1Q 9L3bUh80WAkeOSc2xSPVqSsrNQlzWH49/F/xllBl9K0oSu60vRuvYnyOkX0ZhiGelPIC 46s99+RENU69WU4sCP4Irwt5IV2fWuEHRsm1B9VQkuoEibYF9P7fnEIhoUdKki4TqNGk wHWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Dy94xOtc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id p1-20020a170902e74100b001c3e9b0bae1si70834plf.443.2023.11.16.11.42.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 11:42:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Dy94xOtc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 46414804C552; Thu, 16 Nov 2023 11:41:39 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345396AbjKPTli (ORCPT + 99 others); Thu, 16 Nov 2023 14:41:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229487AbjKPTlh (ORCPT ); Thu, 16 Nov 2023 14:41:37 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5B3118D for ; Thu, 16 Nov 2023 11:41:32 -0800 (PST) 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=ri1OUYfeB6un/pQ9MDSMKyqtm4r6z514s2TDXJOWFn4=; b=Dy94xOtcCY9GChQwtWnMZGS3go hxmAFND9w9PN992qFoz294Dsdc/k4wKcFCVPsgjs+egkzP37et7DcVPF2octLTyl9m7tE3b7FpRBW iZ3K+ieHfnjP4c/fgfqPqqra8qvtQ6/rb9ml62LOTsxZFteIt1CtWCHWNjoStJZqR192t3ZezVfjV WgIfA5QYMqyPJw34jcqwl8uYqrXiMtuIi3E5pvvI0y8jSJlGGTiHRRkiaZjcOTTL/B7jsNE62BTTK C/f2CfquinH3y4Tz4Acfc5t02ZYx4a5o+f8GGD9zT+la+I+cmIVKchs8jYQBLQAeUwRP+Y7hIqBGE 3WMZfS3w==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1r3iEw-004ugH-GB; Thu, 16 Nov 2023 19:41:26 +0000 Date: Thu, 16 Nov 2023 19:41:26 +0000 From: Matthew Wilcox To: Peter Xu Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Mike Kravetz , "Kirill A . Shutemov" , Lorenzo Stoakes , Axel Rasmussen , John Hubbard , Mike Rapoport , Hugh Dickins , David Hildenbrand , Andrea Arcangeli , Rik van Riel , James Houghton , Yang Shi , Jason Gunthorpe , Vlastimil Babka , Andrew Morton Subject: Re: [PATCH RFC 07/12] mm/gup: Refactor record_subpages() to find 1st small page Message-ID: References: <20231116012908.392077-1-peterx@redhat.com> <20231116012908.392077-8-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 16 Nov 2023 11:41:39 -0800 (PST) On Thu, Nov 16, 2023 at 02:40:21PM -0500, Peter Xu wrote: > On Thu, Nov 16, 2023 at 02:51:52PM +0000, Matthew Wilcox wrote: > > On Wed, Nov 15, 2023 at 08:29:03PM -0500, Peter Xu wrote: > > > All the fast-gup functions take a tail page to operate, always need to do > > > page mask calculations before feeding that into record_subpages(). > > > > > > Merge that logic into record_subpages(), so that we always take a head > > > page, and leave the rest calculation to record_subpages(). > > > > This is a bit fragile. You're assuming that pmd_page() always returns > > a head page, and that's only true today because I looked at the work > > required vs the reward and decided to cap the large folio size at PMD > > size. If we allowed 2*PMD_SIZE (eg 4MB on x86), pmd_page() would not > > return a head page. There is a small amount of demand for > PMD size > > large folio support, so I suspect we will want to do this eventually. > > I'm not particularly trying to do these conversions, but it would be > > good to not add more assumptions that pmd_page() returns a head page. > > Makes sense. Actually, IIUC arm64's CONT_PMD pages can already make that > not a head page. > > The code should still be correct, though. AFAIU what I need to do then is > renaming the first field of record_subpages() (s/head/base/) in the next > version, or just keep it the old one ("page"), then update the commit > message. Yeah, I think just leave it as 'page' would be best. Thanks.