Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp54130rdb; Thu, 16 Nov 2023 11:41:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IFTo3uB7KUYcfHsjkQJknmG6wbwYdUwVrKxg+pkFOFmRdLTL22VV0xPVP9OBVL206jbDqXV X-Received: by 2002:a17:902:e84b:b0:1cc:787f:fd2 with SMTP id t11-20020a170902e84b00b001cc787f0fd2mr10888564plg.49.1700163676518; Thu, 16 Nov 2023 11:41:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700163676; cv=none; d=google.com; s=arc-20160816; b=fT5MYwpl0gN2DduBPca6DNmnrDEqCAooujdxHXEpvGNMNrBJMB8EsCTgblSv/5cKIO GURwPgm4wJzDLK3c/OH6ULACZDXmXFMeziBPdCApFLz/WDt0myEecHlN3/VkbO1UONRW /jEu2kImhH7WRb4Mv8BCvdqkuljEr6MsZfgFtVhZ64A91YoDs0LHlT3zDzxt9VqYXyru F68sEDGSw5bhlukAtI/EtjhMY5aE2QVI2sgX9BnUKP/HaMD0Rx9TsnlB2e0HI7eWC6Fu l/vdYKkT7dIoljLYZ+eDnGCllMoA9IejoHruoD6A9mQqMTLpPB60LvoQrLtFMCuN37NC a6sw== 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=Bzv535wMnAruLzQr/48/AxY7g2OnZub15Z3F0evMKPM=; fh=zh+XCG4Kj7z+5VA25f8FtYK2jyTE0MzYVlZfUqJzie8=; b=xLWVkAhH9urSzXJfOH6/XHCEAVE7V7MDiunIehIwXkq1mu9FBc5jxma4+GfDCDdRIq xyfh2G6cAbKKTu0He5Gw0/Ahgn3+gRqONutJ5vkA0Iu1IRLIqxtiSVFuc9rYrSveXYV6 vSB1jSCsMfY+YboBI3SEPe4aZ26BHbY7FDs5jO3ESDh9nRv0ePIY/niEsaAmJiV8YThi tDPmB5MfBtC5thHuJgRyG2RQ9QZ+BP3Fon57NVCZNbk3Gmi0KRAaumB4nvIwIKK634+T 1vT4mXWqbO/dia6RaJsMrBxvXmfKiNCNoT7eEVblxzkHSSTbRG6vkSgYY9JGmdTB0AOO 9O5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Bc7Xkzk6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id b1-20020a170903228100b001cc43334839si61204plh.521.2023.11.16.11.41.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 11:41:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Bc7Xkzk6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 0867A806500D; Thu, 16 Nov 2023 11:40:44 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345368AbjKPTkc (ORCPT + 99 others); Thu, 16 Nov 2023 14:40:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229487AbjKPTkb (ORCPT ); Thu, 16 Nov 2023 14:40:31 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8B4F1A8 for ; Thu, 16 Nov 2023 11:40:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700163627; 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=Bzv535wMnAruLzQr/48/AxY7g2OnZub15Z3F0evMKPM=; b=Bc7Xkzk6fXiIDJypPVZ0TRP0Qejqwc8R95elAVcTDfjw3Aafawqshj1Y0SxgrjD2BzGhme XoNkYCLkVCzcrTSIpkd9rnTWWy4BKwwEBTUn/8q3yN+Tn4B6XDcCnU/ADOj4VBXGbI5VAf iiWNqwp52kUdNJAC+Dn7NwvuB4ytxIE= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-550-CY_CXqb5MKuTEwYLUBBd2A-1; Thu, 16 Nov 2023 14:40:25 -0500 X-MC-Unique: CY_CXqb5MKuTEwYLUBBd2A-1 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-7789a2b35f1so12997585a.1 for ; Thu, 16 Nov 2023 11:40:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700163625; x=1700768425; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Bzv535wMnAruLzQr/48/AxY7g2OnZub15Z3F0evMKPM=; b=dAhYNc71MrEd3vmfMdbfEKlSwXbqyetW0FP3AgyKJhUCaUNCteVvUil924joytJE4C 4/MpviXqnrykdD39Z6zM4tr8iUSjqRuivKg7NXtv+WAAkShFkvS9BTlt7VcFzpB7Dykw xAPZPJMuFOGZyFz6tpvKZPID7e7zI2Uk7jvcGB+Y8Kv3pQZkV2oNa55iBOJ0mKTe5Rp2 PMb/CvQJ1mxczT0uBnvki7Gtj273S2HyrqkWLsKw7HhTiMb2P+KtkCY/sATvwvinn5GD kub/MwHsTpnUTNVX9FmGupyF+HV4wpJihRuIgEy39rATh7cgIBdE3IXdJSMgsC5mxe/R W+wQ== X-Gm-Message-State: AOJu0YxO7hHz3N8M/3pXtl+EWkvo6pyUDMu9jKqmb1ZgrPa5H466uwvs g4j1gymWmgEW/RJdeaKjrwk1G6bIoiUQX13EltvSICFtLhcoVePx4PBSvfQANTTNnl1clb4hxq9 vyX+eSFKcgOasZAk8J8sRsavr X-Received: by 2002:a05:620a:3715:b0:77b:dce8:737 with SMTP id de21-20020a05620a371500b0077bdce80737mr9794667qkb.7.1700163625224; Thu, 16 Nov 2023 11:40:25 -0800 (PST) X-Received: by 2002:a05:620a:3715:b0:77b:dce8:737 with SMTP id de21-20020a05620a371500b0077bdce80737mr9794659qkb.7.1700163624980; Thu, 16 Nov 2023 11:40:24 -0800 (PST) Received: from x1n (cpe688f2e2cb7c3-cm688f2e2cb7c0.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id rv4-20020a05620a688400b007756c8ce8f5sm44204qkn.59.2023.11.16.11.40.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 11:40:24 -0800 (PST) Date: Thu, 16 Nov 2023 14:40:21 -0500 From: Peter Xu To: Matthew Wilcox 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=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=0.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SORBS_WEB,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Thu, 16 Nov 2023 11:40:44 -0800 (PST) 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. Thanks, -- Peter Xu