Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp568307rdh; Thu, 23 Nov 2023 11:41:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IHSJuk1cQSTA/8JW2uZkxAy5gfe9zEvsAOWMy81NguLI9jxa5JCs+fFbNyceE2yVhMXoowX X-Received: by 2002:a17:902:bb8c:b0:1cf:a0e0:8cfb with SMTP id m12-20020a170902bb8c00b001cfa0e08cfbmr300051pls.9.1700768502815; Thu, 23 Nov 2023 11:41:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700768502; cv=none; d=google.com; s=arc-20160816; b=GjHgLhbx0z0awyU4MRdE5gdJD7EFs406bO7POfKMz3bUsudq8zBMbLEaHGuA6Al0KM B+h9kZhJwiWFds+cCs/9A0jJtrR30lXjuLH5sK97Ny82jLYwmbZCgfyt2uktkt+a5868 JoA2B+bLXihdvDLWNRH5F6mw4ITh9Djf3xU8a5X27HQT57clOtsxj2wSKda0YhGY5UAb VPlAvzZAI9SmIJ2OXZ5DS5AJVWujwAeW9VHz5j5rGIAQt7WWQ5TnxOVU+EDbcyHebi+o y8J1etaEt7exE5H4YFFPNp4Jm2DHk0F2q2ccPnDhkJt3iGFligdxaZu0XkJMM+vlbyY4 b/LQ== 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=xmOn5+FX7gFongPnnuombqlFZm27jJX8g7knRz4U4Fc=; fh=+cn7NQSSAiKef1qjM4UyBdKrBEcgFqU1TcG/9xyAu2E=; b=hipiE6q0TvslTGa8Y2r9Xg2eDLt60/4OK5yzHWSLTyE17G0xEdoHCkONClLUWr72oB STjARU67wiS6XEr9qrkzbHvFQbnYM3lbs9gOHqV2rqoJVKwvXVzaYr/s5eLmY8+AZSOe wBcR4ZSq5cNAotH/hsFKhO9wKLM/TBz4JEGjVCcBr3sloaP+WmWlgmp8FOAeSY2Soueh KMgLk6yKSTYZOFD6YGfyyI2h5m+I9uIKXQwQzxR9Mz1A7fqCzczIbgiv3/7V3TTK0+k8 LDN1b8Yqvg6sl34wh6dbxZ16VzihrTXeAFUhF3jBBZ0MKHWQA1WRAOSipJ5rNFEhAMaW 7E6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Tm9POf0V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id jb15-20020a170903258f00b001ccab03f008si1709753plb.185.2023.11.23.11.41.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 11:41:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Tm9POf0V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 5266C804B036; Thu, 23 Nov 2023 11:39:07 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229709AbjKWTiz (ORCPT + 99 others); Thu, 23 Nov 2023 14:38:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229664AbjKWTim (ORCPT ); Thu, 23 Nov 2023 14:38:42 -0500 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 A5AB31993 for ; Thu, 23 Nov 2023 11:37:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700768243; 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=xmOn5+FX7gFongPnnuombqlFZm27jJX8g7knRz4U4Fc=; b=Tm9POf0VUvJ6IlPmwpWos+8bxsDPJVfUTvl4x3TYcJ4jwG28IFLi592SLP+yUPhgJgSnM3 2C1WRWXALzzPN2Ki0j5R/huaKYitO5MklpLHwjBNAPv64hBRko5tZa3JpwqqA6gxbJSXbl C86aQcBa718MeP6kHWYQ5EMfoonEIww= Received: from mail-oa1-f72.google.com (mail-oa1-f72.google.com [209.85.160.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-608-97tkLO_lMMus0et7M8vDFw-1; Thu, 23 Nov 2023 14:37:22 -0500 X-MC-Unique: 97tkLO_lMMus0et7M8vDFw-1 Received: by mail-oa1-f72.google.com with SMTP id 586e51a60fabf-1f9efc41382so457fac.0 for ; Thu, 23 Nov 2023 11:37:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700768242; x=1701373042; 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=xmOn5+FX7gFongPnnuombqlFZm27jJX8g7knRz4U4Fc=; b=TPpzVGIMTakgSEU2FdTWEa3VgKwpne/47y5Z/zn3xC1vPtjUdBdZCcWA5ZA0HunoJ+ JaeeFca9wvnsqgTxm6AMpq/QTk2pXyZqPyGJoGJd4fa7UUuqNFXIhihiEvCOZvCgOmVn 4+J8G6JX8n/ZONxzC4c0zkQz7j0Lru14Sx5cR/DmVjukFMlsL/bVqtbDO9EsQRxTYSiX QbGhRzY7smiwYUJY5nLcV4V4HhABOQtkBvigC+aJwjSjeoJWjmT22kz2XXPHUulGDYTx AVG0VVD+hiKUd+iF2YJD6PqtT2GZ4EPxxkIvfHIVaOuQgY1Ac7Q8jfr75o1Kii6cNPL5 O0iQ== X-Gm-Message-State: AOJu0YzDfyXkD3W5R3UcsmfO9EK5HvKLDmcSQPbM1sPtGYn0r9CW2bbO RBLgSfVX400WJdWCzweSYs7SN8DOV9IDvG/4L2wXtKLPXk4er8cp4Iid390qoBxt9k+6FwfcuYI o0BiAULsKnfVXFWZk/wOySiQr X-Received: by 2002:a05:6870:d0a:b0:1f9:5346:2121 with SMTP id mk10-20020a0568700d0a00b001f953462121mr357560oab.4.1700768241736; Thu, 23 Nov 2023 11:37:21 -0800 (PST) X-Received: by 2002:a05:6870:d0a:b0:1f9:5346:2121 with SMTP id mk10-20020a0568700d0a00b001f953462121mr357535oab.4.1700768241485; Thu, 23 Nov 2023 11:37:21 -0800 (PST) Received: from x1n (cpe688f2e2cb7c3-cm688f2e2cb7c0.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id kd26-20020a05622a269a00b00421b14f7e7csm690038qtb.48.2023.11.23.11.37.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 11:37:21 -0800 (PST) Date: Thu, 23 Nov 2023 14:37:18 -0500 From: Peter Xu To: Christophe Leroy Cc: Christoph Hellwig , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , Andrea Arcangeli , James Houghton , Lorenzo Stoakes , David Hildenbrand , Vlastimil Babka , John Hubbard , Yang Shi , Rik van Riel , Hugh Dickins , Matthew Wilcox , Jason Gunthorpe , Axel Rasmussen , "Kirill A . Shutemov" , Andrew Morton , "linuxppc-dev@lists.ozlabs.org" , Mike Rapoport , Mike Kravetz Subject: Re: [PATCH RFC 06/12] mm/gup: Drop folio_fast_pin_allowed() in hugepd processing Message-ID: References: <20231116012908.392077-1-peterx@redhat.com> <20231116012908.392077-7-peterx@redhat.com> <57be0ed0-f1d7-4583-9a5f-3ed7deb0ea97@csgroup.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <57be0ed0-f1d7-4583-9a5f-3ed7deb0ea97@csgroup.eu> X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 23 Nov 2023 11:39:07 -0800 (PST) On Thu, Nov 23, 2023 at 06:22:33PM +0000, Christophe Leroy wrote: > > For fast-gup I think the hugepd code is in use, however for walk_page_* > > apis hugepd code shouldn't be reached iiuc as we have the hugetlb specific > > handling (walk_hugetlb_range()), so anything within walk_pgd_range() to hit > > a hugepd can be dead code to me (but note that this "dead code" is good > > stuff to me, if one would like to merge hugetlb instead into generic mm). > > Not sure what you mean here. What do you mean by "dead code" ? > A hugepage directory can be plugged at any page level, from PGD to PMD. > So the following bit in walk_pgd_range() is valid and not dead: > > if (is_hugepd(__hugepd(pgd_val(*pgd)))) > err = walk_hugepd_range((hugepd_t *)pgd, addr, next, walk, PGDIR_SHIFT); IMHO it boils down to the question on whether hugepd is only used in hugetlbfs. I think I already mentioned that above, but I can be more explicit; what I see is that from higher stack in __walk_page_range(): if (is_vm_hugetlb_page(vma)) { if (ops->hugetlb_entry) err = walk_hugetlb_range(start, end, walk); } else err = walk_pgd_range(start, end, walk); It means to me as long as the vma is hugetlb, it'll not trigger any code in walk_pgd_range(), but only walk_hugetlb_range(). Do you perhaps mean hugepd is used outside hugetlbfs? Thanks, -- Peter Xu