Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1831427rdb; Tue, 3 Oct 2023 02:15:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG89F7NplpcALA0DIBkuJZoD3jrr3Za39r/MPYCgvdbD6F/oWz1cxwnG4OzS4+1Uo40aJmK X-Received: by 2002:a17:903:41d1:b0:1c5:e527:68b0 with SMTP id u17-20020a17090341d100b001c5e52768b0mr17933992ple.62.1696324529491; Tue, 03 Oct 2023 02:15:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696324529; cv=none; d=google.com; s=arc-20160816; b=kqZZruYb/ErotvFrqQ1H/W6qmVbkUYqdoFrdfwfk9e10V27nCca50lj52DBDfkCKPn HJuby87Yo+5D1l7vs9Eb+qHzmxYsAC4K7B+IJ33fycKW6DDn8bPEazzoPCx6NMiqrX38 NEegmYCH8K361Xdv06P6Y7/bsyA9dl6PYmHlbJq0B0wTjanXMVBeU+GbYLdMMcE+NYrT 47Sk1lwGcnoogyQ0/bEQrKbLxHFWetwsmmuPHj30cEbzgAHovr/S6ZAoegpN48uaG5kz T30gb2AhOd9dMaLkFYavY9MoV5kCmZ1QCHuo9W+9tqVMo0sjBZ1bdEY0yFTKzzi7nACP qm9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=VwYZSOOB/glvz2EnW/qnimnVXLIQ+wJ0Ri+lf09J6gI=; fh=uua5dLukz2E+eiUjHQ3XQZ9nrmHo6GVFaq4ywUulylI=; b=riuzpwthCiwlhYXjo7RZ+Rot1EdzUCsQ+7TINnJQpO8jkyR4ERmm6atm82AhRcflrY uOhZm+Mrzi0A5LwevLWxqIvBTXz3DiHrlF6bA5gmx5cz5HYQvrWXw47UTBxtVWPt1kBu qxRnKAS2iQl9Nc994wNGRDGnpK4aCnxTHRFTKefn20hHeNjdsW2ztzYJ7MYjf49SwA62 MqF7p/mWGgyvHfo4JN1O6UCElWOCrHQ4p+sTe/NDlOy/PdBF6PCmmeTTMgZO48gAxWQo 1YfpIz+RNPFU5FlaGt2tIFu8+wE0RIBkKXGFpx+tTzs0jTglqQJcAk3CDCRYcKvLkuuG E7OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=OnZFZ40A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id l4-20020a170902f68400b001bc650255b6si1104325plg.390.2023.10.03.02.15.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 02:15:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=OnZFZ40A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 463718271431; Tue, 3 Oct 2023 02:15:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239501AbjJCJP0 (ORCPT + 99 others); Tue, 3 Oct 2023 05:15:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231509AbjJCJPY (ORCPT ); Tue, 3 Oct 2023 05:15:24 -0400 Received: from mail-yw1-x112d.google.com (mail-yw1-x112d.google.com [IPv6:2607:f8b0:4864:20::112d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6F57AB for ; Tue, 3 Oct 2023 02:15:19 -0700 (PDT) Received: by mail-yw1-x112d.google.com with SMTP id 00721157ae682-59c268676a9so8601177b3.0 for ; Tue, 03 Oct 2023 02:15:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696324519; x=1696929319; darn=vger.kernel.org; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=VwYZSOOB/glvz2EnW/qnimnVXLIQ+wJ0Ri+lf09J6gI=; b=OnZFZ40Azgj3uWjlyJMTLvLXYlxokqrNuXf+bhobnWBUVAfcXDn78w24FTdLCn/7WH yKQ5JEcuiKlonNiOl7rJiFODJeflZEINrcKG7B10BHqifAJaRNLc+9kzPowPSqFD2Wmz qRlgt96bzNoom+QD74fwSo5alglnbFuFprHeZrRlA8vQMubH+3oGNtSeyjv2jEODUMFp qoqLkpuJ0XX4f1FEPdPWXcZLtT0PhpLnwTkAPhvVWPB9Xb0aUi0hJEbQ0+ZDu4qTvYwZ nzOB/aoqMxEm9+ctSuimi4NQvWJE0bzsR3LmpG0RTYOht7LHQzGOkthmp//S5kwgUZY4 tA8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696324519; x=1696929319; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VwYZSOOB/glvz2EnW/qnimnVXLIQ+wJ0Ri+lf09J6gI=; b=gmVMnZPDwbOe2z+n74rJhSmnddksScwh7U3VXke6TBaP2Gh5tMaQMBcjBu4kRH64/a Ccs606GH0c/gSQOkUuEL83O/QxppdkmXSXgNYgn9swuFqXYrvJYDF2aHwvcWdqYo9DWQ avN9UdcLqiQ3g5PcHpw3tVg8gmZr6xd4PyOioxUig6gb2O5T5k39tmaVHntJQFeo/wzF hR0e6DiK9U7EsDSao8UGyJwu9HV3qgKERZ2DkBK0Vt1ixRjnNAP6pfcCNEdFC+UeAEnq 0E0AJf5h9tgso8B73ID6Jzj+vQElJJkT5kIji4/DNSvKJKZ2NVUEo1XBDrmea4kcRdhr 1OaA== X-Gm-Message-State: AOJu0YycllyLtB3qKeeEjd68BffeGmY05NbcasdITmAxA4irv2jkMahz uOm2A1Sz0+mDBaww03Z/Yt7eCw== X-Received: by 2002:a81:8907:0:b0:59b:518a:639c with SMTP id z7-20020a818907000000b0059b518a639cmr14262844ywf.36.1696324518906; Tue, 03 Oct 2023 02:15:18 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id m131-20020a817189000000b005950e1bbf11sm244244ywc.60.2023.10.03.02.15.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 02:15:18 -0700 (PDT) Date: Tue, 3 Oct 2023 02:15:09 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Andrew Morton cc: Andi Kleen , Christoph Lameter , Matthew Wilcox , Mike Kravetz , David Hildenbrand , Suren Baghdasaryan , Yang Shi , Sidhartha Kumar , Vishal Moola , Kefeng Wang , Greg Kroah-Hartman , Tejun Heo , Mel Gorman , Michal Hocko , "Huang, Ying" , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v2 01/12] hugetlbfs: drop shared NUMA mempolicy pretence In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 (howler.vger.email [0.0.0.0]); Tue, 03 Oct 2023 02:15:28 -0700 (PDT) hugetlbfs_fallocate() goes through the motions of pasting a shared NUMA mempolicy onto its pseudo-vma, but how could there ever be a shared NUMA mempolicy for this file? hugetlb_vm_ops has never offered a set_policy method, and hugetlbfs_parse_param() has never supported any mpol options for a mount-wide default policy. It's just an illusion: clean it away so as not to confuse others, giving us more freedom to adjust shmem's set_policy/get_policy implementation. But hugetlbfs_inode_info is still required, just to accommodate seals. Yes, shared NUMA mempolicy support could be added to hugetlbfs, with a set_policy method and/or mpol mount option (Andi's first posting did include an admitted-unsatisfactory hugetlb_set_policy()); but it seems that nobody has bothered to add that in the nineteen years since v2.6.7 made it possible, and there is at least one company that has invested enough into hugetlbfs, that I guess they have learnt well enough how to manage its NUMA, without needing shared mempolicy. Remove linux/mempolicy.h from linux/hugetlb.h: include linux/pagemap.h in its place, because hugetlb.h's recently added use of filemap_lock_folio() requires that (although most .configs and .c's get it in some other way). Signed-off-by: Hugh Dickins Reviewed-by: Matthew Wilcox (Oracle) --- fs/hugetlbfs/inode.c | 41 +---------------------------------------- include/linux/hugetlb.h | 3 +-- 2 files changed, 2 insertions(+), 42 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 926d01c493fb..0586c90cb9a5 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -83,29 +83,6 @@ static const struct fs_parameter_spec hugetlb_fs_parameters[] = { {} }; -#ifdef CONFIG_NUMA -static inline void hugetlb_set_vma_policy(struct vm_area_struct *vma, - struct inode *inode, pgoff_t index) -{ - vma->vm_policy = mpol_shared_policy_lookup(&HUGETLBFS_I(inode)->policy, - index); -} - -static inline void hugetlb_drop_vma_policy(struct vm_area_struct *vma) -{ - mpol_cond_put(vma->vm_policy); -} -#else -static inline void hugetlb_set_vma_policy(struct vm_area_struct *vma, - struct inode *inode, pgoff_t index) -{ -} - -static inline void hugetlb_drop_vma_policy(struct vm_area_struct *vma) -{ -} -#endif - /* * Mask used when checking the page offset value passed in via system * calls. This value will be converted to a loff_t which is signed. @@ -853,8 +830,7 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset, /* * Initialize a pseudo vma as this is required by the huge page - * allocation routines. If NUMA is configured, use page index - * as input to create an allocation policy. + * allocation routines. */ vma_init(&pseudo_vma, mm); vm_flags_init(&pseudo_vma, VM_HUGETLB | VM_MAYSHARE | VM_SHARED); @@ -902,9 +878,7 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset, * folios in these areas, we need to consume the reserves * to keep reservation accounting consistent. */ - hugetlb_set_vma_policy(&pseudo_vma, inode, index); folio = alloc_hugetlb_folio(&pseudo_vma, addr, 0); - hugetlb_drop_vma_policy(&pseudo_vma); if (IS_ERR(folio)) { mutex_unlock(&hugetlb_fault_mutex_table[hash]); error = PTR_ERR(folio); @@ -1283,18 +1257,6 @@ static struct inode *hugetlbfs_alloc_inode(struct super_block *sb) hugetlbfs_inc_free_inodes(sbinfo); return NULL; } - - /* - * Any time after allocation, hugetlbfs_destroy_inode can be called - * for the inode. mpol_free_shared_policy is unconditionally called - * as part of hugetlbfs_destroy_inode. So, initialize policy here - * in case of a quick call to destroy. - * - * Note that the policy is initialized even if we are creating a - * private inode. This simplifies hugetlbfs_destroy_inode. - */ - mpol_shared_policy_init(&p->policy, NULL); - return &p->vfs_inode; } @@ -1306,7 +1268,6 @@ static void hugetlbfs_free_inode(struct inode *inode) static void hugetlbfs_destroy_inode(struct inode *inode) { hugetlbfs_inc_free_inodes(HUGETLBFS_SB(inode->i_sb)); - mpol_free_shared_policy(&HUGETLBFS_I(inode)->policy); } static const struct address_space_operations hugetlbfs_aops = { diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 3c4427a2396d..a574e26e18a2 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -30,7 +30,7 @@ void free_huge_folio(struct folio *folio); #ifdef CONFIG_HUGETLB_PAGE -#include +#include #include #include @@ -513,7 +513,6 @@ static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb) } struct hugetlbfs_inode_info { - struct shared_policy policy; struct inode vfs_inode; unsigned int seals; }; -- 2.35.3