From patchwork Mon Sep 25 08:30:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugh Dickins X-Patchwork-Id: 13397485 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2463ECE7A89 for ; Mon, 25 Sep 2023 08:30:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B97E08D0016; Mon, 25 Sep 2023 04:30:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B48668D0001; Mon, 25 Sep 2023 04:30:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A38548D0016; Mon, 25 Sep 2023 04:30:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 9549F8D0001 for ; Mon, 25 Sep 2023 04:30:57 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 6A63F1A030F for ; Mon, 25 Sep 2023 08:30:57 +0000 (UTC) X-FDA: 81274449354.21.ECA63B7 Received: from mail-yw1-f170.google.com (mail-yw1-f170.google.com [209.85.128.170]) by imf03.hostedemail.com (Postfix) with ESMTP id 92F632000D for ; Mon, 25 Sep 2023 08:30:55 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=ijMCI2rC; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf03.hostedemail.com: domain of hughd@google.com designates 209.85.128.170 as permitted sender) smtp.mailfrom=hughd@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695630655; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ulgX9THEbQN3dQQC629PIbXmK6AWD1UO9BuCeRr1HmQ=; b=Of0owKEinj3Tb/i2eb3hDrZ+Cr7SLIvN0XwRYD6rMf1i2n5ooZkDO0hPBXd0ezgNwJdFsM aMXIc9EJ3mwhPYg25u6IypnoZjKDfoWfgwaqAbB51F0ChIbPHxKHbtALqVODHY8Efi/G+K EBPCWxB6Af62wiHV9EUPwNTMBWRBFLc= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=ijMCI2rC; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf03.hostedemail.com: domain of hughd@google.com designates 209.85.128.170 as permitted sender) smtp.mailfrom=hughd@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695630655; a=rsa-sha256; cv=none; b=ACxTzJAK2BF1Cwdjc7PMHpEsz7j/G+fd5Bmi1E4wzHptZIUUywzHOF7HGt6hxxU071wVBf 0p7IyiC8+Isy63FVHXOLLUFy3mrK3XT22QiEro7iPc7Ge6nywsY0jCOCicJW457FUf8CXB F50Utjvvf8M7WVIHWHW4k1YQmHBx41Y= Received: by mail-yw1-f170.google.com with SMTP id 00721157ae682-59bf1dde73fso73722437b3.3 for ; Mon, 25 Sep 2023 01:30:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1695630654; x=1696235454; darn=kvack.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=ulgX9THEbQN3dQQC629PIbXmK6AWD1UO9BuCeRr1HmQ=; b=ijMCI2rCRJFjOWU6IL3JADMzJA+066oAQnDc9SGPkNVyVt3CioYRcFmCPQ8Nal9As6 hCprmMyuAw46oc/KNtNw1Jy25KBrcXJF4CgsjMrQieGCJddK2cfQe7wakrxUniII/1nk o/IboKaitjMq/P/htq/oqqnQH1g+OYCR1mAEb4dLXiVxfQiR+ezCqz5JevxQDEfqpr1R S6I9wDn4Nb0jawvkZQ5INxzfDGB3kBJdvawnW0ts6fJJ3C/jiqe8MACx204eshPMO/DI 0EYfokaYVGUilDcoA4vIB+RSb9n1MxoqL9eRCdBLoHmaHegy1sGBfoG9E60nK/zJf8Uu nsDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695630654; x=1696235454; 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=ulgX9THEbQN3dQQC629PIbXmK6AWD1UO9BuCeRr1HmQ=; b=KIntgr0SsVToUb8kYnxRMiKwb2B7Ngn+Puk4px4jknYBj1voDgu5Gb5iQtFmI/GWwJ m35aWZflr6zqNEYCq01XvFR9l8e8KkGGPa6pOfkE/hQy/Y4ZHYJsi5aQHpgyYHuF+rEI AtwfRnLEcoJXacCBS7t/kpMvDLC2CpLXzXwjf+wZAboBldOkdEiKiVV+NvGQ/Ua3UZGM M9OY/ZCC6FT/64kXQ0KZ8MFLlK4s6hXstu56fBXv+CQDhY5nkHfZ7eLz/PilSv7ApU37 NP4Ia9+vQMh9jKdN+BnvzmSiapbl3RehTgHwYzJNCA9hllfjTPfsk34thCgIQO34YLqt JSug== X-Gm-Message-State: AOJu0YxGEXBw646+vQYeJ8RMXIgvkgGyCem4W/m3QeLnsDLxaqCDhm0y VIXty5pVDM6hbmKSqKg3zo88rw== X-Google-Smtp-Source: AGHT+IEGFXRC2nnrJxyRas7mIKt1ska0D212eRm9P7TUFWDSpRyUl8E9tDZ9Nksk92zJ5nQ/VXHlUQ== X-Received: by 2002:a05:690c:3603:b0:571:11ea:b2dd with SMTP id ft3-20020a05690c360300b0057111eab2ddmr5723589ywb.32.1695630654594; Mon, 25 Sep 2023 01:30:54 -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 j185-20020a816ec2000000b00592236855cesm2259304ywc.61.2023.09.25.01.30.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 01:30:53 -0700 (PDT) Date: Mon, 25 Sep 2023 01:30:51 -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 , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 08/12] mempolicy: remove confusing MPOL_MF_LAZY dead code In-Reply-To: <2d872cef-7787-a7ca-10e-9d45a64c80b4@google.com> Message-ID: <2cb8b08a-a96c-2a61-94dd-4cd51ad0605d@google.com> References: <2d872cef-7787-a7ca-10e-9d45a64c80b4@google.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 92F632000D X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 6awgqkg7tf86ywz6aa9e8kpnw541r4e4 X-HE-Tag: 1695630655-315254 X-HE-Meta: U2FsdGVkX18qhPhH2u3T4pWS3PNrk3kd8TD+UgVg+GwvzsxQXT87KKg32o1n3BfsVzw1swS8V0D7zG1pMD1gWcZGNxYNkzEUrnhDMGYvA4HutvbdlZumI2bab1nqVZo0RNOu5Mm71eWj70M5Pj5eIdTsHNXwnfD4gxOGQ2z/wnEAqXZ5JQveuE1t/zfvg3AjZPup0+sNCvjtbmAxQPYMiSazkvhJRlMc6HHwo/ya252bqeCDqX+Fc/IjdcvoXslhDiRX7lEzomlNLRueYvBm07+vDbYsBIF+CSez55iRamFPxXoCnJ/101uztzzrix4tq29ohFC23FxSFFit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WQbM4vFpm/r3rbN2DPkio2T4WMFvuGGDqwY20kKL8xgk0GRixBSWO5lURJi6wTjBP46eTOSwVqVj5siDPVDKpLHgrLuIrCsmdAnBcvFzqlMGAmPstXTrT3DUonbMPgp8yZDoCJm1R6bZxoACfstZqipJeitOPxF7YoXwhUpXnQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 a22b641cfd6b..7ab6102d7da4 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -632,12 +632,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, @@ -676,14 +670,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. @@ -1271,9 +1257,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 @@ -1318,7 +1301,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); }