From patchwork Tue Oct 3 09:24:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugh Dickins X-Patchwork-Id: 13407342 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 9D12CE75438 for ; Tue, 3 Oct 2023 09:24:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3D8CC6B0162; Tue, 3 Oct 2023 05:24:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 388D16B0164; Tue, 3 Oct 2023 05:24:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2512E6B0165; Tue, 3 Oct 2023 05:24:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 174676B0162 for ; Tue, 3 Oct 2023 05:24:24 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id E4E701C9FEC for ; Tue, 3 Oct 2023 09:24:23 +0000 (UTC) X-FDA: 81303614406.13.8A90C74 Received: from mail-yw1-f175.google.com (mail-yw1-f175.google.com [209.85.128.175]) by imf28.hostedemail.com (Postfix) with ESMTP id 2D9DEC000C for ; Tue, 3 Oct 2023 09:24:22 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=E1GCEx0U; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf28.hostedemail.com: domain of hughd@google.com designates 209.85.128.175 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=1696325062; 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=ooRbfvgflrDJY0S/ihm6kiwAA3KtmVPaxx1CoMlS90Q=; b=GsGGl72RYYOW8NNWNURQ/dtSJMtsAWh4DCozQTKFSB6faw4OwcFhibntAdc1p9I9mGqX+0 CrcG5sGHkZdwkmU7UppMJDcbgzV2ubTO5p4dgwLEVmTwGQ6wg+jT1WjDE27458YmsY+Z9B BlZBgQXZLZk/lcuVPkyivcXzM7jDq1A= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=E1GCEx0U; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf28.hostedemail.com: domain of hughd@google.com designates 209.85.128.175 as permitted sender) smtp.mailfrom=hughd@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696325062; a=rsa-sha256; cv=none; b=UA8xOSc7v5FSia+Yho4yE+g1YN+8oITFu3jn3zk/9B1PvM0M2Qwq3LzQJfmvI5UrAyd5ec GK9OwULUJWAjnYgjtJugHsdY/zFvzZgyOf/210RwH/d9S4jEjj+XCQBsLzz6xu6uISjf3N I7ho++oLaeKCMLLlecDzFL24eLu0ZCU= Received: by mail-yw1-f175.google.com with SMTP id 00721157ae682-5a21ea6baccso8561607b3.1 for ; Tue, 03 Oct 2023 02:24:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696325061; x=1696929861; 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=ooRbfvgflrDJY0S/ihm6kiwAA3KtmVPaxx1CoMlS90Q=; b=E1GCEx0U+akYpyD58nzae/DFw5IH+roqhL9f0nBJfTDn0d35GohOXfW617tLq/eQ7B 8fyp2W2R4o4otZbgBz/DyzVo0l9cya9GIWJsgnPoYtelREoutG/GSTUUp15jVpL+NgMh tTZrYxw4V+/rL8duxxxMj7b5dbn9GShBYbICxZqzeNIA092FIL4Q1cr25pCGRe9JoLJu 1WF2Sl7NpwDEROZTjCv4JaOhOznGawNJ38XnqFHGutz08HWpEjSFO5QaHXjxGtnzCnI8 kUL35vDuaRoLUczE7tUMjCrabL7Yu7bufB54ULmRc7yY6KIRW+P4C5yV+kA/1GyhgLY/ Ys/Q== 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=uUuAkUxP2dy+ZXJcaLq0xFD2XIwZCMsajvvAXjUtzemIC81pT5FzhWY/PwePI8Cr4O tNnhgSmB7PE6hFHr/UCmr9oSihp2kUFJieAxLQ3t7U/P887TLa+BdDtZZ50WMX/ZhHmQ FUjXrlWAKbPDVY+kkENG6HrR1ogvEDf5TkKPzS0chfmuaD1MfooZaxrg+kMADjvz5mjz OJY4phwJZnazM8smZ+abaEUXTdm8EzIJZr2S4lDQrk4jXrk+D5unqoXtR9flqPdd3fJg ItJ4bA/J014+DexwDLoRfT/A43NgXAX5QNCD/qMyMlRMSW4g04LgFjxLWzqwxv5HtCRP Erng== X-Gm-Message-State: AOJu0YzIxW0M78i1iu7RofWwm3QEcS5DBok7xw3wJyca7cqJicC1oqvX RHBmLGO306HwjYukiPIc6AQxXw== X-Google-Smtp-Source: AGHT+IF7dS6FmToNAISxPIKOdrXv16fI38OSw83FP5I+O2/LMzV34kyuZxVB4HUMbC6kZMjwwcoTsQ== 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 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 2D9DEC000C X-Stat-Signature: ouwbudbz9op7dk4tfmufar34f6id8u7q X-HE-Tag: 1696325061-92440 X-HE-Meta: U2FsdGVkX1+UdP0Ku36wETYHff2iniRxTZRXPUMUgdnJXeZ7kHDIRPJKyG0jAOkmL7JQF/Yr9gqaoUS4UgDy1F0PbWkej2ArVhsPkQGZoTzVmQimFf4wp84EdJlM4OOTPDGAwRRf32lsrBPzlEFEM5JIfwCuB20UEkhGeH8u8KR61yZDBv46J5WL7MM+1ewCHBjQvz4cm7KwmtVZ8EeB9asejND8JnXKT/lDIub8S9CX2u5oPTIvZksVrt82nKsQXceceDL7sLHgcmYF3O1t79wgtoLIPmhi9z7WjvOwnBZ6QOkKWmdZLmhG6rIziGdoqTpNO1q7WNawe5Qvdfq/XQGMqaWIBowGSO9s6aATFOC3yp7niYXjht2pCp9VnWJIk8cr2VbeRCUBPERkHxZ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wqDZ3zV4wBEdJDfzsfMWXMG3iRscQ1rnmH7u/ncN84QVyNLjUMFyuhQp3gLY5Q+mT1l7Ys07bpNPunsVo3puqygvnibLvceJ+TSA4FqybG3L6Ucr5N0hY54mw+CRtrs4Qnaatiy2z57Mt72UM9SsSWagzCXzO12QTzWU= 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) Reviewed-by: Yang Shi --- 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); }