From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6AE53EB64D9 for ; Wed, 14 Jun 2023 14:58:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245653AbjFNO6p (ORCPT ); Wed, 14 Jun 2023 10:58:45 -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> 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.