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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6DFC3C54E71 for ; Fri, 22 Mar 2024 20:48:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Mime-Version:References:In-Reply-To: Message-Id:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jTVesUm8fZ+/VwsK16DIIUsgAJF8QZnvZKBUnqgvi3k=; b=jzeL4xVrvQEXDJ cVGv6VAu+POkGPeBgHpLgYMwZslc/rsZQ9PAgmfzrrMJ3+47Tkea29ilYwiO+LsN7kOkLFh1ucmr1 G4oMiFRxHKe7hXOS9+Iqx6lyc36+7yctgpGoY80qw900NWypEYz2rYEekPfbMt4dLzqMtOaLRmS9+ FFlb6wnIPzO3UTwgfjsfuJHkddc4mZif+FGwGhVtKH60Kxmcyeeht/xhBK9NZzOJHK2L2SkkGe250 AGczsu39wCp5ufFmZXbX+SJ97vYBWv9zwamUgbLlE+OEFr0V0gYqH9dZSaoPV5hD6VpWfKGKkkN4H 4ltSV8TIqmJl67mnrA0A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnloR-00000008dpn-15rG; Fri, 22 Mar 2024 20:48:27 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnloO-00000008dox-2HG6; Fri, 22 Mar 2024 20:48:26 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 5D07ECE182D; Fri, 22 Mar 2024 20:48:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C52B0C433C7; Fri, 22 Mar 2024 20:48:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1711140499; bh=Uf9dSpYITp6bxdnwZZqCFp6GDVfEBgn7BjvTh1fsU0E=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=QVRAKzAUPqWp2P8fFfJjymQCiqf8/IWwd1wmqWmnRlxsqAjKHpKVO/2FMY54BdYVe MtuhTuaPMg1SbalsaWAguHK6KathmRCmewglEhgp1kUsqyLrxGR7rhkCkBiCs/cIST Foh0xWAZf8YKEf1Z8kAQrZNZWmXaYiyM/6VzFqZo= Date: Fri, 22 Mar 2024 13:48:18 -0700 From: Andrew Morton To: peterx@redhat.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Michael Ellerman , Christophe Leroy , Matthew Wilcox , Rik van Riel , Lorenzo Stoakes , Axel Rasmussen , Yang Shi , John Hubbard , linux-arm-kernel@lists.infradead.org, "Kirill A . Shutemov" , Andrew Jones , Vlastimil Babka , Mike Rapoport , Muchun Song , Christoph Hellwig , linux-riscv@lists.infradead.org, James Houghton , David Hildenbrand , Jason Gunthorpe , Andrea Arcangeli , "Aneesh Kumar K . V" , Mike Kravetz Subject: Re: [PATCH v3 12/12] mm/gup: Handle hugetlb in the generic follow_page_mask code Message-Id: <20240322134818.9b312f77629f79fcf1564b6f@linux-foundation.org> In-Reply-To: <20240321220802.679544-13-peterx@redhat.com> References: <20240321220802.679544-1-peterx@redhat.com> <20240321220802.679544-13-peterx@redhat.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240322_134824_977723_CDBDB8F6 X-CRM114-Status: GOOD ( 19.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, 21 Mar 2024 18:08:02 -0400 peterx@redhat.com wrote: > From: Peter Xu > > Now follow_page() is ready to handle hugetlb pages in whatever form, and > over all architectures. Switch to the generic code path. > > Time to retire hugetlb_follow_page_mask(), following the previous > retirement of follow_hugetlb_page() in 4849807114b8. > > There may be a slight difference of how the loops run when processing slow > GUP over a large hugetlb range on cont_pte/cont_pmd supported archs: each > loop of __get_user_pages() will resolve one pgtable entry with the patch > applied, rather than relying on the size of hugetlb hstate, the latter may > cover multiple entries in one loop. > > A quick performance test on an aarch64 VM on M1 chip shows 15% degrade over > a tight loop of slow gup after the path switched. That shouldn't be a > problem because slow-gup should not be a hot path for GUP in general: when > page is commonly present, fast-gup will already succeed, while when the > page is indeed missing and require a follow up page fault, the slow gup > degrade will probably buried in the fault paths anyway. It also explains > why slow gup for THP used to be very slow before 57edfcfd3419 ("mm/gup: > accelerate thp gup even for "pages != NULL"") lands, the latter not part of > a performance analysis but a side benefit. If the performance will be a > concern, we can consider handle CONT_PTE in follow_page(). > > Before that is justified to be necessary, keep everything clean and simple. > mm/gup.c:33:21: warning: 'follow_hugepd' declared 'static' but never defined [-Wunused-function] 33 | static struct page *follow_hugepd(struct vm_area_struct *vma, hugepd_t hugepd, | ^~~~~~~~~~~~~ --- a/mm/gup.c~mm-gup-handle-hugepd-for-follow_page-fix +++ a/mm/gup.c @@ -30,10 +30,12 @@ struct follow_page_context { unsigned int page_mask; }; +#ifdef CONFIG_HAVE_FAST_GUP static struct page *follow_hugepd(struct vm_area_struct *vma, hugepd_t hugepd, unsigned long addr, unsigned int pdshift, unsigned int flags, struct follow_page_context *ctx); +#endif static inline void sanity_check_pinned_pages(struct page **pages, unsigned long npages) _ This looks inelegant. That's two build issues so far. Please be more expansive in the Kconfig variations when testing. Especially when mucking with pgtable macros. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel