Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2960296rwd; Wed, 14 Jun 2023 09:21:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4+w8HZFaP71L9u3xD5yebM3cuuuiNesxbxZZU4BBtWzB3cFdYh9rznrZ7wfSTiRfKadRK1 X-Received: by 2002:a05:6a20:7f81:b0:11d:162d:bb7 with SMTP id d1-20020a056a207f8100b0011d162d0bb7mr1979585pzj.41.1686759680835; Wed, 14 Jun 2023 09:21:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686759680; cv=none; d=google.com; s=arc-20160816; b=EnPSxWHT0t6Pg1uljh7j3UHo2JQHHHE+hyhqOLeI5jk43aDFvkzkqUaUd9sZCgshZg CvkwubJ608417Lj2XByYNu0hGCpof6Vy+ZaSSocCmVyIzzoQGAU+OaIyxUfSiZL2gLAK XyOc6Ixkqf/RLisIg8i4FyC2PPkWSCqMVCgYBUmAE6lzWehs1CgYuPz/zMJbSFbfJ1mU PzEz3n2YxSn8ykJEE3zLf9yzvOoRMbLRFv9u/s0OHswR04eq1Ex5DQLAteGUFkkhHRrx C/04cfTtYPrjm5UIdTqNcxfus4um6guZbcv8IT1iFt2MlVONUM0htmBMSWRQR/l2ZmUj nuZA== 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=gmwzH0CjVLzqwLy7siJrCROCQ7j4iPuuS4OQ5spBH/E=; b=jSKNeGea5dta3mJbWiNpvD4zosZxqt8QzuL8ZIiUeZnn16WKKof8nGXr2eE4WXpYuv lrB/MWWoknLQpZeeH83p/gsldmtL5Flmn3OMbMzMZqs22330a10FALBlkqBIukNPY5hn R7sZwGFWkvdgs7bf8AkCvDk02V6MLeoT/Cvmm8zDF+5Y77XKCjdtS9GxevKC1kW+OHnH vSRB/6qmxYAbMT2C4seF4ylQoSm/2QiipeOYqQmsjas/cai+HiQlx0gccFH0FP/2dWWr 4S43LFUDevrpNlZMh0hqNJwKboGcMHRghUjNDl/CiRJSRDayzCd0X1oRe3lxf1JCh7o5 5vuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=exAMnlNG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k17-20020a170902ba9100b001b3e8b1d5c7si3575031pls.260.2023.06.14.09.21.06; Wed, 14 Jun 2023 09:21:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=exAMnlNG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236224AbjFNPgG (ORCPT + 99 others); Wed, 14 Jun 2023 11:36:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235947AbjFNPgF (ORCPT ); Wed, 14 Jun 2023 11:36:05 -0400 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 2ED20C7 for ; Wed, 14 Jun 2023 08:35:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686756922; 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=gmwzH0CjVLzqwLy7siJrCROCQ7j4iPuuS4OQ5spBH/E=; b=exAMnlNGa1kxKj5+T3GK/yUcyMtZp12zVaDIMuL3IQm7y6eUw8Bg/9oCzS5t+cjKkd0kkG 21/ToNvm9AYdHh7ZkK9WEZs+jD/iEUZmcu5uKM5Ku38pcEm1foplyzP9YBIGIxKu0jno26 Q/pRf7Khqbk+lMPFkvea6wp0cizBBLg= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-142-53WoW33HPT-_m5obgIsd2Q-1; Wed, 14 Jun 2023 11:35:21 -0400 X-MC-Unique: 53WoW33HPT-_m5obgIsd2Q-1 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-62fea7a5de9so583846d6.0 for ; Wed, 14 Jun 2023 08:35:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686756920; x=1689348920; 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=gmwzH0CjVLzqwLy7siJrCROCQ7j4iPuuS4OQ5spBH/E=; b=cyAeQPzB7ju9A4Tnj+N40NKmlrBlsBgGiOIkUq3twVNS5XqEPxmCfFXQGkjo+IDadb h97Lges8R31thJYWQKIjSNxjHn9ewEObn9Qa6QMyB/gJso9rLu2OxakVzhS7X2DDYeNs JiasJ+JHUhor7OYSkKfoG2dVNUpQRK26a0URcCBEDFrXCl3xV80ZA7ix7vjUYGe2P2fk jKnFP9b8/kjZufBw06DINOtjdnMmrOGSM2Zlz/vVsXD22RUsQ6BDTke9AAXX6qncM7zk 81KqDXrmt4xIkJjMSd5fJeDs2fvx7pRgGqOmSWdRP572GFIdQlnTtx6QycbZ1iO25GHr VNxw== X-Gm-Message-State: AC+VfDwxhSgafZUpZOmpYzwYxWz/axAJMXoB4C6cHoWWJz0RoOrYupC9 DbTRTFYqoC491THPVdMxDN/GZgWig9MGht5nitCmrDOIrN3q5vTdgAw6n4fgW/p6pvCw8TvJP4A 0D8K/l4SUcPcKDAtkEdERo6kz X-Received: by 2002:a05:622a:1a02:b0:3f6:ab9a:3d8e with SMTP id f2-20020a05622a1a0200b003f6ab9a3d8emr20549379qtb.4.1686756920611; Wed, 14 Jun 2023 08:35:20 -0700 (PDT) X-Received: by 2002:a05:622a:1a02:b0:3f6:ab9a:3d8e with SMTP id f2-20020a05622a1a0200b003f6ab9a3d8emr20549357qtb.4.1686756920392; Wed, 14 Jun 2023 08:35:20 -0700 (PDT) Received: from x1n (cpe5c7695f3aee0-cm5c7695f3aede.cpe.net.cable.rogers.com. [99.254.144.39]) by smtp.gmail.com with ESMTPSA id j8-20020ac85c48000000b003f9b6d54b17sm5106366qtj.58.2023.06.14.08.35.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jun 2023 08:35:19 -0700 (PDT) Date: Wed, 14 Jun 2023 11:35:18 -0400 From: Peter Xu To: Matthew Wilcox Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrea Arcangeli , John Hubbard , Mike Rapoport , David Hildenbrand , Vlastimil Babka , "Kirill A . Shutemov" , Andrew Morton , Mike Kravetz , James Houghton , Hugh Dickins Subject: Re: [PATCH 6/7] mm/gup: Accelerate thp gup even for "pages != NULL" Message-ID: References: <20230613215346.1022773-1-peterx@redhat.com> <20230613215346.1022773-7-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=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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 On Wed, Jun 14, 2023 at 11:19:48AM -0400, Peter Xu wrote: > > > + for (j = 0; j < page_increm; j++) { > > > + subpage = nth_page(page, j); > > > + pages[i+j] = subpage; > > > + flush_anon_page(vma, subpage, start + j * PAGE_SIZE); > > > + flush_dcache_page(subpage); > > > > You're better off calling flush_dcache_folio() right at the end. > > Will do. Ah when I start to modify it I noticed it's a two-sided sword: we'll then also do flush dcache over the whole folio even if we gup one page. We'll start to get benefit only if some arch at least starts to impl flush_dcache_folio() (which seems to be none, right now..), and we'll already start to lose on amplifying the flush when gup on partial folio. Perhaps I still keep it as-is which will still be accurate, always faster than old code, and definitely not regress in any form? -- Peter Xu