Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2906862rwd; Wed, 14 Jun 2023 08:44:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5mXbPNbg6aRUzboVpNBJgQyPEMBYtsV3IPo135bW0ggJyY/J/jfoIoS3yKEOW8yJKGy15G X-Received: by 2002:a17:907:96ab:b0:96f:f98c:ac71 with SMTP id hd43-20020a17090796ab00b0096ff98cac71mr14840922ejc.67.1686757497418; Wed, 14 Jun 2023 08:44:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686757497; cv=none; d=google.com; s=arc-20160816; b=GA2lHjp3Nw75VZ1XPj/uOZSkTurRD4luvIqEBsTQN+LTvPuKQEo0pX9J8sYV+zDRvw +rodvInRAHXVNS7ObEgu8ElGrDr89BE5JRw/4OiOtisA8B8XXFQptdhrxf/A0ONFUvuu ueWyiTpxdJbThmYzNJQLjzS/BRvH9Fta3LS06g4scJGSynrmP5n8hA620niYoDtaKDjm 8MUPdLYHAzvsr+6OPI+99u2fRjRdC+b/12Y2j1SINJvblOhfuyyONTkuAvb649ph1Pno /kU5ngw0fGPaKrInHQrwomS1tXn8s99EvvCOX1JMzMfwn4WBH9UNwFl5KTjrvj7lRB3t mQ/w== 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=c+DUuKPNc+TCTVK85+ONR9/WBIlqrFGJwe0k+eUv3R4=; b=E5rE0mJMVSAUlzeoyExiRZIR1Y8jad0ICpfbMRdCI52n87fUAF4bhZxuDsY8M92R6p V9Fbfb+CIdrbVQyz1tK7vncTFtng/aEIj6ly21eU9BumBRuDOtskLoVPp0Yh55Sff8io G9ysCGD2gun2GmMZwh1+tnauti5HCqs25zksVKpPztyda9O60QrY1alYZ2aPBv+lq/Ik TSljS8//UaEJ1Zpl1UrSIlRmYeM2RQ4cQuUC85PU7/RxNujdDl42ACfqRVpa6lWLP2Rb 7d5iHbVit3KGmbgqgEYPUKkxzY9Aaef/hai7hNH7QNGEugL1iYwPtC2sasP7S7TCH1hf WK/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=s+Foz2h7; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n23-20020a170906b31700b0094a86ccb630si8029154ejz.893.2023.06.14.08.44.11; Wed, 14 Jun 2023 08:44:57 -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=@infradead.org header.s=casper.20170209 header.b=s+Foz2h7; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245634AbjFNO6o (ORCPT + 99 others); Wed, 14 Jun 2023 10:58:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245239AbjFNO6j (ORCPT ); Wed, 14 Jun 2023 10:58:39 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB77D198D for ; Wed, 14 Jun 2023 07:58:37 -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=c+DUuKPNc+TCTVK85+ONR9/WBIlqrFGJwe0k+eUv3R4=; b=s+Foz2h710mseAM15VhBFXvVbv HnJzv2lzoy1MDnLHOCJ1NiZO8FcPrZTDVAA8SI2XVCG/6SiXWDm1dJVKw0vRHoQIuP2vr9Xh6Mld/ ZDT/3a5d5Y+J1mlMA0tXUAxHS/4RdplskmthXG+w8QO8eTPwyAf8c/a9h/9oGTmu3JpU70z/7Kwgo K6/iFy68SK1lTA7+veAiIUJCz4ynMQrFINSKE7VFept+g7ONH/qQSNXvgLoZBflIQDrmX28RUm2M+ J/Roi+bORWpHpSJyUknT1GwwzuS+pEelkxjhqztgWf/Gs96xw0g/4eCGot3IKatyqLmSVOsLHXQ/p YnWczeNw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1q9RxC-006Rio-NA; Wed, 14 Jun 2023 14:58:34 +0000 Date: Wed, 14 Jun 2023 15:58:34 +0100 From: Matthew Wilcox To: Peter Xu 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=us-ascii Content-Disposition: inline In-Reply-To: <20230613215346.1022773-7-peterx@redhat.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 On Tue, Jun 13, 2023 at 05:53:45PM -0400, Peter Xu wrote: > + if (page_increm > 1) > + WARN_ON_ONCE( > + try_grab_folio(compound_head(page), You don't need to call compound_head() here; try_grab_folio() works on tail pages just fine. > + page_increm - 1, > + foll_flags) == NULL); > + > + 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.