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 2C678C54E71 for ; Fri, 22 Mar 2024 15:55:36 +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:In-Reply-To:MIME-Version:References: 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=ab/zZtKgIq4SajRvUXjJA+E2ob8+fGNTTNFCa13wlTc=; b=dMdNzL/mx+TL7T REN5xXGSnLFBOvd+pdLEjDESLxqObMi5+tOtGafnkb7jiLjMCN2aKP43T4blg89FaA0Nw0aQJd+7t d4FbytZCzYmHmD+0jcIufUtI9R+eOa6k9bFGp64f8CpAsP55BSB+uuhT25pHpM5CkUjT8jSHQbQfE icXn84LQ15E9DkmRXs/SOfSqntME/YvZO0IDTnaVfJBhoszLy3UJl5T6k9gWYd2pyIdjwF7T7A7kH JpPo54SPKR9Nwi4P/bcaVR4kLBWwXa9Oq6goZ8ooNZy8WJxaF8WtUWSqPD9SxWAIHR2Bad8EtkUYs 0JktQe91mh4+Xax4g3Hg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnhEp-00000007psp-0Phx; Fri, 22 Mar 2024 15:55:23 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnhEm-00000007prY-06MG for linux-arm-kernel@lists.infradead.org; Fri, 22 Mar 2024 15:55:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711122919; 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=QJLFb75dlh9Ilo5izUjxoeGL/8+am1RJvB8MBnP+8/Q=; b=Toy4bsv3Ad85EA+NvHhY+40Wru/FLAZfGe5Va6JZ2KGVavZpglqvuJLQ+1oTB7EtyfyHM2 ZydbIPdbAg0z6EHbiLi7IpXveKI5PQTW3tCfNf+/yoBiixUmpN3zvNLydlbKPjMaq58U0P fVP4gPz4L4phy7Szq+YaNPZgCJb93Rw= 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-22-Xi_UVDE6MiipbAS-zMHoYw-1; Fri, 22 Mar 2024 11:55:16 -0400 X-MC-Unique: Xi_UVDE6MiipbAS-zMHoYw-1 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-690d3f5af86so5121026d6.0 for ; Fri, 22 Mar 2024 08:55:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711122916; x=1711727716; 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=QJLFb75dlh9Ilo5izUjxoeGL/8+am1RJvB8MBnP+8/Q=; b=W2Reiy3jgrKjpAMcMznBD9BaNZLK2vTFPn+JIVrn0ElhNWH+4HGKh59ZWci9D6b6Nu 6xbtxl81vuuC5uHAU2e67FqXqkXX6FrXxlbRLQvNsMpew327kxTzOjJW7THxXCsZlGif mV7dBwiiTI2mQW8yr+nx9aHv8PqDZKuSQrdNJx1MNN/cO6QHgJ600uIJFRaVe7+Kg8H+ MmwiZkY+7Duuz4ODS4SyJYocn0kdXdE/85l1mgqlxtgcMNwUseRBlKfip5T7t2tAh7Kh 0MvuAmFRk4PkrOIh1a3QqrDjOVD+sYmx7pejchy/CVh/L5ng53X+yEGFL7SvyjsapwLs b8LQ== X-Forwarded-Encrypted: i=1; AJvYcCVbFJecS6ENuuT1gXsACvym5/Z92gCd6Uj5RYNoeOxi7biKh3cW8sOOTZeUDVsZDD0Qumsyvt+xZN7dA/R9OMb71N6TCUMFC2hSMcTzJ2cWJMT0KK0= X-Gm-Message-State: AOJu0YxbIy6pa99ziVlme61f4elZPPgZfBa5j2nbxmT62hnxVY7pbIg8 7fVmCJExfKYpL0u3iNFpYuKyCiPXmNcFpLXFPx91ayUKENY2X66+csZPOXi8QngCCRGgcMGot09 7ZeWVnx4N33caMe1ME65PsMHleiTY/hA7jO/fJweC+75DSuvoUhfKx2bh44lp4e92oNePtiiM X-Received: by 2002:a05:6214:2b86:b0:696:732f:41ce with SMTP id kr6-20020a0562142b8600b00696732f41cemr1030609qvb.0.1711122916034; Fri, 22 Mar 2024 08:55:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGcGgYl+6vk8GOgJHrnHh9Bk553GXwTOWFwJfwdxmayaEVIZH35b8wrrTSaV+/rgNR3L0gYLQ== X-Received: by 2002:a05:6214:2b86:b0:696:732f:41ce with SMTP id kr6-20020a0562142b8600b00696732f41cemr1030577qvb.0.1711122915578; Fri, 22 Mar 2024 08:55:15 -0700 (PDT) Received: from x1n ([99.254.121.117]) by smtp.gmail.com with ESMTPSA id jx12-20020a0562142b0c00b0068ff8bda6c7sm1185452qvb.92.2024.03.22.08.55.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 08:55:14 -0700 (PDT) Date: Fri, 22 Mar 2024 11:55:11 -0400 From: Peter Xu To: Jason Gunthorpe 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 , Andrew Morton , Muchun Song , Christoph Hellwig , linux-riscv@lists.infradead.org, James Houghton , David Hildenbrand , 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: References: <20240321220802.679544-1-peterx@redhat.com> <20240321220802.679544-13-peterx@redhat.com> <20240322133012.GI159172@nvidia.com> MIME-Version: 1.0 In-Reply-To: <20240322133012.GI159172@nvidia.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240322_085520_331932_4CBC6407 X-CRM114-Status: GOOD ( 25.10 ) 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 Jason, On Fri, Mar 22, 2024 at 10:30:12AM -0300, Jason Gunthorpe wrote: > On Thu, Mar 21, 2024 at 06:08:02PM -0400, peterx@redhat.com wrote: > > > 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(). > > I think this is probably fine for the moment, at least for this > series, as CONT_PTE is still very new. > > But it will need to be optimized. "slow" GUP is the only GUP that is > used by FOLL_LONGTERM and it still needs to be optimized because you > can't assume a FOLL_LONGTERM user will be hitting the really slow > fault path. There are enough important cases where it is just reading > already populted page tables, and these days, often with large folios. Ah, I thought FOLL_LONGTERM should work in most cases for fast-gup, especially for hugetlb, but maybe I missed something? I do see that devmap skips fast-gup for LONGTERM, we also have that writeback issue but none of those that I can find applies to hugetlb. This might be a problem indeed if we have hugetlb cont_pte pages that will constantly fallback to slow gup. OTOH, I also agree with you that such batching would be nice to have for slow-gup, likely devmap or many fs (exclude shmem/hugetlb) file mappings can at least benefit from it due to above. But then that'll be a more generic issue to solve, IOW, we still don't do that for !hugetlb cont_pte large folios, before or after this series. > > Reviewed-by: Jason Gunthorpe Thanks! -- Peter Xu _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel