From patchwork Tue Oct 3 09:12:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugh Dickins X-Patchwork-Id: 13407295 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 8BB6EE75436 for ; Tue, 3 Oct 2023 09:12:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 04DDD6B0138; Tue, 3 Oct 2023 05:12:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F401D6B0139; Tue, 3 Oct 2023 05:12:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E07AE6B013A; Tue, 3 Oct 2023 05:12:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id D1A466B0138 for ; Tue, 3 Oct 2023 05:12:27 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 8D951160219 for ; Tue, 3 Oct 2023 09:12:27 +0000 (UTC) X-FDA: 81303584334.18.BED1AFB Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com [209.85.219.181]) by imf27.hostedemail.com (Postfix) with ESMTP id E390840017 for ; Tue, 3 Oct 2023 09:12:25 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b="1/wlKZd/"; spf=pass (imf27.hostedemail.com: domain of hughd@google.com designates 209.85.219.181 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696324345; a=rsa-sha256; cv=none; b=1+lKBYwv9gaMFqi+8dKhE6M+s0oSZzTa8DF5cciTqDrR+4so8u7UlxCWqhMT/i2oiHAcAJ XbvCz5IEj40639fjYZGk7wOFF2URFHcgBMU7bCNNSOS9bjKIQSTaw8XDxEJsJ9YiDQboUH XkdGvaNbiuiO7m0QKVDnxJZba7d5hvA= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b="1/wlKZd/"; spf=pass (imf27.hostedemail.com: domain of hughd@google.com designates 209.85.219.181 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1696324345; 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: references:dkim-signature; bh=vwdKPsSZX5lF9BZ1cbD7q6c/KB8Lk1EC3PAauvodoEY=; b=fSD1o/Ly4DStvCmEjyEwhQv89yMt8Dk+1LFwKHmi7dEzG7bhqmRwbN2xN18nFK+vfJGRPu Dml8ttj8H34JNi/JwWzoruEpgJbB+KbYJeXgf6ePLBHmtwSdWGZ3ysDBsNk1jGF56CwPMj OfSiMX49eKsiVFOxRqXj40OvSLu2rCU= Received: by mail-yb1-f181.google.com with SMTP id 3f1490d57ef6-d865854ef96so701231276.2 for ; Tue, 03 Oct 2023 02:12:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696324345; x=1696929145; darn=kvack.org; h=mime-version:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to; bh=vwdKPsSZX5lF9BZ1cbD7q6c/KB8Lk1EC3PAauvodoEY=; b=1/wlKZd/88pxI4RovJQCPxRpqx8hZFgj6ZXphZ8770rCaINLB3Nnma4k2nr1RoO5UJ riO9iQ3NLcgVan8pGvkkbq+SYgkUzBZnNoIM/Xabl33SuPbR/xN97RVZeLWZQinrW9GY tiE4qvD9NvrDIsevydc4MAxywXOePvS0Phv4jv3cjxzpbu6ZucKkl1E55H4GMqSel45r GdrgSA+7OC7uV7Q40D3Jd3w/bH2/Lg4f5sMgCxjsULrCylOc7UTOhIRl0ftoGgNfMM2c ZWol68b9nO1+sO110t8c4ZbVJ+Y5xsofW4eE6l6ycIJykf0fWXXwaSC+u9DvBbn8jqI7 UGlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696324345; x=1696929145; h=mime-version:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=vwdKPsSZX5lF9BZ1cbD7q6c/KB8Lk1EC3PAauvodoEY=; b=EwVRxDarIpc8A1ZrnOAhoVSSYG67URWEP5PNZf3NJpnPb0MD8CDtX9X0y+/+612F6I O5GyEa0V7Agdq62AQas7VYBFMVNn5aSqbZPEuvp7JcUBC4AY6OYXBW+TQ7bMjRiQWMEd AQentJCeeWJYjjTm/WdJW8yQer4ovNxxdlHRuI2zYLd1QmIpEwUFqbyC+1m7IIoW05aH P5I+hz9ZeF+wfMKSkKJpWxHtknN8MjxsXOWeGpoZq/4pVzFzFQTjn/ewiPd7NSFdwU78 r6dIOBlovDgGD537yM5/F0YljJ1AqH4VHysik8WTGPx9tMFmeJjZKCznCLqoYdFlcXrz RscA== X-Gm-Message-State: AOJu0YwufQiAsoq0q12k9Z8dkV+LKQXqFxhNUXW6oB5UQChsJsLOMUsl uFtXDq+rL087FdNiV9CGbDeNbQ== X-Google-Smtp-Source: AGHT+IHeox1fltLEhdIRRcLFlBpcEWhixSw6n5wz+13doXbu/4zqff/jwBbGoie468vAGNRgTE+iFA== X-Received: by 2002:a5b:251:0:b0:d81:a0c5:f274 with SMTP id g17-20020a5b0251000000b00d81a0c5f274mr12294841ybp.48.1696324344885; Tue, 03 Oct 2023 02:12:24 -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 w7-20020a05690202c700b00d7ba4c5e31fsm274592ybh.39.2023.10.03.02.12.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 02:12:24 -0700 (PDT) Date: Tue, 3 Oct 2023 02:12:14 -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 00/12] mempolicy: cleanups leading to NUMA mpol without vma Message-ID: MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: E390840017 X-Stat-Signature: 7zw88bstg3q6wanuoq6euskngj4a6uee X-Rspam-User: X-HE-Tag: 1696324345-970438 X-HE-Meta: U2FsdGVkX1/i5TuJaf3VaB3zQjBAEw+2bUEGDrjokUyo2dmDlPuGbdU7mhn/UeMdOYzS+RPJle0V7pvF/NhGPWuBIFlRAyEQg6FPiNjX2y9QJ0U6w4/FQfr6l5lX1yFYhjfM6rfr6gfIjs7/fR6NkW/PvjYa33+skLNp21iWaZ3xuDSCZIcI7Q7IiMnTUwzgytj8qTYlHpX6tgRbklNN9KV7vWx+od+JK8b0rv/4zBSj+fZx9N14jGPxPjpSCPMijthSYzaCCitYMW7mZEt2/o99KUWSTkasD+CGsJvZSit8xKuiFRIqzR44Jf/ExPfnPIDlzAIGcq3u5JXiww6g62IpRM/MfKLN0QZYMV74IVwPI1KEEeYkkK4xFYlTQ1ipEe5KN1ztv9e03DDoZk4xQItt8tpIuz1bIJGiVjrLEQMbr9KGkzT2OE4XXBOZdfasUK4JOaknYB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0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Here is v2 of a series of mempolicy patches, this version based on mm-everything-2023-10-02-21-43, applicable also to next-20231003: mostly cleanups in mm/mempolicy.c, but finally removing the pseudo-vma from shmem folio allocation, and removing the mmap_lock around folio migration for mbind and migrate_pages syscalls. This replaces the "mempolicy: cleanups leading to NUMA mpol without vma" https://lore.kernel.org/linux-mm/2d872cef-7787-a7ca-10e-9d45a64c80b4@google.com/ series of 12 based on 6.6-rc3 and posted on 2023-09-25. 01/12 hugetlbfs: drop shared NUMA mempolicy pretence v2: add reviewed-by Matthew hugetlb.h include pagemap.h for filemap_lock_folio() 02/12 kernfs: drop shared NUMA mempolicy hooks v2: add reviewed-by Matthew 03/12 mempolicy: fix migrate_pages(2) syscall return v2: add reviewed-by Matthew replace Yang Shi's qp->has_unmovable by qp->nr_failed remove ptl,addr,end to queue_folios_pmd() per Huang,Ying reword comments above queue_folios_pte_range() fix incorrect migrate_folio_add()ing per Huang,Ying which also fixes qp->nr_failed as count of folios 04/12 mempolicy trivia: delete those ancient pr_debug()s v2: add reviewed-by Matthew 05/12 mempolicy trivia: slightly more consistent naming v2: add reviewed-by Matthew 06/12 mempolicy trivia: use pgoff_t in shared mempolicy tree v2: declare struct shared_policy (the root) before struct sp_node reformat sp_lookup, mpol_shared_policy_lookup decls per Matthew 07/12 mempolicy: mpol_shared_policy_init() without pseudo-vma v2: sn,npol instead of n,new (but no optimization) per Matthew 08/12 mempolicy: remove confusing MPOL_MF_LAZY dead code v2: add reviewed-by Matthew 09/12 mm: add page_rmappable_folio() wrapper v2: move page_rmappable_folio() to mm/internal.h per Matthew 10/12 mempolicy: alloc_pages_mpol() for NUMA policy without vma v2: adjust to fit on top of earlier mm-unstable mods 11/12 mempolicy: mmap_lock is not needed while migrating folios v2: remove HugeTLBfs special casing of src->index 12/12 mempolicy: migration attempt to match interleave nodes v2: remove HugeTLBfs special casing of page->index fs/hugetlbfs/inode.c | 41 +- fs/kernfs/file.c | 49 -- fs/proc/task_mmu.c | 5 +- include/linux/gfp.h | 10 +- include/linux/hugetlb.h | 12 +- include/linux/mempolicy.h | 44 +- include/linux/mm.h | 2 +- include/uapi/linux/mempolicy.h | 2 +- ipc/shm.c | 21 +- mm/hugetlb.c | 38 +- mm/internal.h | 9 + mm/mempolicy.c | 988 ++++++++++++++++------------------- mm/page_alloc.c | 8 +- mm/shmem.c | 92 ++-- mm/swap.h | 9 +- mm/swap_state.c | 83 +-- 16 files changed, 630 insertions(+), 783 deletions(-) Hugh