Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1834689rdb; Tue, 3 Oct 2023 02:24:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFhM+XgX8p6mkVNhd0wTXScOmvSVwfZpZwp71SOphwlYh/EQhxWtXdCKNaVyWNM1hCMGWA3 X-Received: by 2002:a05:6871:594:b0:1d5:cdf7:bda9 with SMTP id u20-20020a056871059400b001d5cdf7bda9mr16350432oan.41.1696325068444; Tue, 03 Oct 2023 02:24:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696325068; cv=none; d=google.com; s=arc-20160816; b=lHCnUJND7JADfSBS/bA068ppmceKMZwzsUO6dPVvrjl/u4uGscW0w8Aei5qrUAUNFr D/7JDYnrc9m4hy2FRh2yMP4RyWUrPG989vkzPQsFqqGZ9JZcr58EBYYaieaD/uaDVaxG Tb0NvoEe6o10G4Nnz4lPk8aOw95h7wAdVQIbxJ3/UR29xiTtgswA5sU7H345+MRkJP18 xgRZKOF30/5nm0C+x6QakZUbWuZS+PKqTOx6BJXOR+nuvFaH2Mx/i8ro7w+2kztns34Q I2cg9ef/J0upo52WKbF2l+V+ktv6Tz2s7w+b/YJomSiQsQO7pDU6up5CrnWFDGvvcHq8 Rqvw== 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=ooRbfvgflrDJY0S/ihm6kiwAA3KtmVPaxx1CoMlS90Q=; fh=uua5dLukz2E+eiUjHQ3XQZ9nrmHo6GVFaq4ywUulylI=; b=SzrvrNUxMtD1PXGHLTZuJu+sHiFwaNunT+A9GmI5d7EHTNneP+trJofdLIFvE1JcJ1 FdlcXb42tFqpuQh3JYD3BtRz7TiImelTd/C2RaKrYapiMMHdKdqc7BXMJa76HkkHHMB2 QeRt7LjCiypJonjF1rmq61cSd8UjAaFbekByJHZXEfxjbic1BJFIYGRq6d6tuLsQ7NN4 C7mSAfa1rlFvbKrjE28NeA+h6FJc+alaNIrAUJ9RSQBKCMrNz52L7IYo3J19DkO0hQvk Jge96scEO/RFECLsCLSRXgrPIaNPP0Zl2Qgos4shsKrn7D22nGmNpR858rEJ2nS8hTy4 bl7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=fQhXw5qO; 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 r8-20020a63fc48000000b005859e8c7c2dsi1020397pgk.639.2023.10.03.02.24.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 02:24:28 -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=fQhXw5qO; 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 6E8CB827AF87; Tue, 3 Oct 2023 02:24:27 -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 S239587AbjJCJY0 (ORCPT + 99 others); Tue, 3 Oct 2023 05:24:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239647AbjJCJYZ (ORCPT ); Tue, 3 Oct 2023 05:24:25 -0400 Received: from mail-yw1-x1133.google.com (mail-yw1-x1133.google.com [IPv6:2607:f8b0:4864:20::1133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F584D8 for ; Tue, 3 Oct 2023 02:24:22 -0700 (PDT) Received: by mail-yw1-x1133.google.com with SMTP id 00721157ae682-59e77e4f707so8703087b3.0 for ; Tue, 03 Oct 2023 02:24:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696325061; x=1696929861; 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=ooRbfvgflrDJY0S/ihm6kiwAA3KtmVPaxx1CoMlS90Q=; b=fQhXw5qOFrZ+qe5pfcTUSkuk7nURhFWkGQ6lxdt4sX/fzZmHedjnxQAI/8xRJu7ohs wEHBzC6oCYe+NvDRiDOCobj3OWG4JaHCzJhdI24oS/BeCOxbsI3bhQ/EWjRp6ogYgrjk fL3EDNEXsl/EEG67YYHz+embQVFNVuAqdfbsWI6+iqqWgHD9JiTadqSO58v5fjYuFuRu T892yINe2+ADCsL+kGn5GvLU6E7P7aRHp0gcu6/xMsr/QQdMGM3+Y8kIPWgWzfwYrQAF skMj7PQm/snd8HKnFlv16jsbbHV45BhdHJWoj9RWrcPsYrbVPC+mhgoTlnZ5evEkHXGl 7tig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696325061; x=1696929861; 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=ooRbfvgflrDJY0S/ihm6kiwAA3KtmVPaxx1CoMlS90Q=; b=bKnEPGLK82mgCVkMZggfeiJt7toZ5b016ziUiWiCR13Cm6cnQKOuacXocC8HTh1Rj7 Z4EGILGL6Tf9El7zOb9Sf5WCBMcyu0gnqHKk6ZKG1cyNwBDgoiNPi515ULHSViP+iIl0 fIcWXh0aBjReUsb3EtWCCmHwcYtg4iHvFbtNmnQbAp+t9OJMCRJ7ZNF0+ObNGspeWyAO haMoLWHlzNUJcar2yJA/7e51jXvRxSpmdaKC0YJFcJBgOltBBdcdmmhQL+Nyk+Bxwsbm QCHhTodR6XwC5FKcWXPDht7OfCVzTpviYbEmccx9j2jHmKhKSDln5QbAbaNXTyEhPWze 19lQ== X-Gm-Message-State: AOJu0YzmKdkyQXTtGBI8CPTDOTYPSuW9K4y5WaHeyTEWd85q0pQVeR8g ZUn4T3uXW5js9jRUkyQyjIRI9A== X-Received: by 2002:a81:a08b:0:b0:58f:ae13:462b with SMTP id x133-20020a81a08b000000b0058fae13462bmr14655078ywg.4.1696325061140; Tue, 03 Oct 2023 02:24:21 -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 x9-20020a814a09000000b005463e45458bsm251441ywa.123.2023.10.03.02.24.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 02:24:20 -0700 (PDT) Date: Tue, 3 Oct 2023 02:24:18 -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 08/12] mempolicy: remove confusing MPOL_MF_LAZY dead code In-Reply-To: Message-ID: <80c9665c-1c3f-17ba-21a3-f6115cebf7d@google.com> 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_NONE,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:24:27 -0700 (PDT) v3.8 commit b24f53a0bea3 ("mm: mempolicy: Add MPOL_MF_LAZY") introduced MPOL_MF_LAZY, and included it in the MPOL_MF_VALID flags; but a720094ded8 ("mm: mempolicy: Hide MPOL_NOOP and MPOL_MF_LAZY from userspace for now") immediately removed it from MPOL_MF_VALID flags, pending further review. "This will need to be revisited", but it has not been reinstated. The present state is confusing: there is dead code in mm/mempolicy.c to handle MPOL_MF_LAZY cases which can never occur. Remove that: it can be resurrected later if necessary. But keep the definition of MPOL_MF_LAZY, which must remain in the UAPI, even though it always fails with EINVAL. https://lore.kernel.org/linux-mm/1553041659-46787-1-git-send-email-yang.shi@linux.alibaba.com/ links to a previous request to remove MPOL_MF_LAZY. Signed-off-by: Hugh Dickins Reviewed-by: Matthew Wilcox (Oracle) --- include/uapi/linux/mempolicy.h | 2 +- mm/mempolicy.c | 18 ------------------ 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/include/uapi/linux/mempolicy.h b/include/uapi/linux/mempolicy.h index 046d0ccba4cd..a8963f7ef4c2 100644 --- a/include/uapi/linux/mempolicy.h +++ b/include/uapi/linux/mempolicy.h @@ -48,7 +48,7 @@ enum { #define MPOL_MF_MOVE (1<<1) /* Move pages owned by this process to conform to policy */ #define MPOL_MF_MOVE_ALL (1<<2) /* Move every page to conform to policy */ -#define MPOL_MF_LAZY (1<<3) /* Modifies '_MOVE: lazy migrate on fault */ +#define MPOL_MF_LAZY (1<<3) /* UNSUPPORTED FLAG: Lazy migrate on fault */ #define MPOL_MF_INTERNAL (1<<4) /* Internal flags start here */ #define MPOL_MF_VALID (MPOL_MF_STRICT | \ diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 5d99fd5cd60b..f3224a8b0f6c 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -636,12 +636,6 @@ unsigned long change_prot_numa(struct vm_area_struct *vma, return nr_updated; } -#else -static unsigned long change_prot_numa(struct vm_area_struct *vma, - unsigned long addr, unsigned long end) -{ - return 0; -} #endif /* CONFIG_NUMA_BALANCING */ static int queue_pages_test_walk(unsigned long start, unsigned long end, @@ -680,14 +674,6 @@ static int queue_pages_test_walk(unsigned long start, unsigned long end, if (endvma > end) endvma = end; - if (flags & MPOL_MF_LAZY) { - /* Similar to task_numa_work, skip inaccessible VMAs */ - if (!is_vm_hugetlb_page(vma) && vma_is_accessible(vma) && - !(vma->vm_flags & VM_MIXEDMAP)) - change_prot_numa(vma, start, endvma); - return 1; - } - /* * Check page nodes, and queue pages to move, in the current vma. * But if no moving, and no strict checking, the scan can be skipped. @@ -1274,9 +1260,6 @@ static long do_mbind(unsigned long start, unsigned long len, if (IS_ERR(new)) return PTR_ERR(new); - if (flags & MPOL_MF_LAZY) - new->flags |= MPOL_F_MOF; - /* * If we are using the default policy then operation * on discontinuous address spaces is okay after all @@ -1321,7 +1304,6 @@ static long do_mbind(unsigned long start, unsigned long len, if (!err) { if (!list_empty(&pagelist)) { - WARN_ON_ONCE(flags & MPOL_MF_LAZY); nr_failed |= migrate_pages(&pagelist, new_folio, NULL, start, MIGRATE_SYNC, MR_MEMPOLICY_MBIND, NULL); } -- 2.35.3