Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1830662rdb; Tue, 3 Oct 2023 02:13:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH/erRsHY+2u3RhRugecl78emYRpWV3enx9GdcV2mDuvS1YL0c90tkq5R+GxaGGtszNmvn/ X-Received: by 2002:a05:6358:e49f:b0:143:7bba:3c73 with SMTP id by31-20020a056358e49f00b001437bba3c73mr15988002rwb.1.1696324402041; Tue, 03 Oct 2023 02:13:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696324402; cv=none; d=google.com; s=arc-20160816; b=ddASPsrkAU7qZQtoYVnmTWBCG9b5HuexLaG0BbOphKrIkFvunjUiUxHfMlCpFOY+qe 64PluCvT9rskouejJpGZBl33kn2pORwUmHQ5R2qVXUNoKxrRpPDzy2rIv0ptRbbRzlUZ 5y+0de/Iwy+kRHnyX+PsAaZHmNXwej33rx0a5w858ow/oTBd3Uis2PLzrBwYeS2Lydld ZVemgwybU5cl/clinPfQeSrJVZRP7iYxjtAbNGqVlQNBWSOltEBRopyebJD6pFcvvkmN xXLvODyGC/HnjZZYO3bCcUg1HyIgf1Pr9fG2RM/CM9nFXqp6OllrKN1jx8IL8/ImXDyD 2eHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:subject:cc:to:from:date :dkim-signature; bh=vwdKPsSZX5lF9BZ1cbD7q6c/KB8Lk1EC3PAauvodoEY=; fh=uua5dLukz2E+eiUjHQ3XQZ9nrmHo6GVFaq4ywUulylI=; b=ShHNqmbj8gvTa41ElnhjnTTfeQdPCpOPpQJf78p1iA8hmsUgrGU+eJE4m7cIhR9uMe UF0hFhiw+mp9lp69psERglIoEkJyGGxnDhIQRy/IR1jYAyyOGgu/TcS+nQ7YVL0QeiIm 4LgdzK+dynF4fg7l3E/wibrTgjyl1FViSaq38WRDFfDF4y8ZJagWl4d5Q8ffLsY1uhkm 4nY++0eVSZaFfEiyAjRqdDFLLumcpy2J7HvDcbO98brSNcH4bTULSYnYipCzLELzAWoy XnqW5K7KOX/sxlENonFinTLuY9F0g762LPDNhrOT0I5t5kgkvX5a/uhNTwLg1VpwF47i q0CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=LOufoRZc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id k12-20020a6568cc000000b00565610b2ed5si977668pgt.794.2023.10.03.02.13.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 02:13:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=LOufoRZc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id C74F580238A6; Tue, 3 Oct 2023 02:13:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239681AbjJCJMv (ORCPT + 99 others); Tue, 3 Oct 2023 05:12:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239631AbjJCJMe (ORCPT ); Tue, 3 Oct 2023 05:12:34 -0400 Received: from mail-yb1-xb2f.google.com (mail-yb1-xb2f.google.com [IPv6:2607:f8b0:4864:20::b2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E748A10D for ; Tue, 3 Oct 2023 02:12:25 -0700 (PDT) Received: by mail-yb1-xb2f.google.com with SMTP id 3f1490d57ef6-d81afd5273eso699219276.3 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=vger.kernel.org; h=mime-version:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to; bh=vwdKPsSZX5lF9BZ1cbD7q6c/KB8Lk1EC3PAauvodoEY=; b=LOufoRZcPrXDsGdwQo1HsndzLcdo7VhBUWm2XT3uvQiomIVfYe3dkfZZMw0ridFNOx 0Utb1GSeHBwzt2FqFsJgn8mSGNaHn8sgLGGNgKaXa880xly+y67kSbzGDR6r0NHy3gqg yrWdl87ldtZHyHhYcHgFV3LrUvxhDxrMnlHI3/LY1/bY6bVPy+KZiAmPlldmG3zKQwJS 0cZElmkVr7tplsXs6Sg4k3gJDAD2ZHbBhU+WgUDoJbY1INqjY6tIedtiYZ+M+ZNGKeKG lix1MAv/7qhmOHwy7foryyTxAloI7UrY+KNEEX2E3scszI8Ou0GxjsRQhe/gcV3Qs2s5 9a0w== 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=S8Iok2X8VroNfFO9AL3t14TtR25NjzjsMs0AYYgPH1/VdeaMPpFVKZSJ9ZuOzUPUgm G29wi080jz6foctw8p2Pf4RZEzZKol69K5zWaG2+XEyTBqBUr5xyW4DPbn5hPRpv1Vtl PVJBhGGLZGRMIC1ImkvW5oqPRwhU+4YkHfcNa1nOfdXp8FgIIctYBiioI63tOkDSTKvL Spjf6fVDI8yu5aKesDR76zMKT58wPyHSw0Izs/OnpNUkRgzYr7kuZmpRK0CUotx5Jp72 dAHCf4kIXEKeNVUl+DvYIRiL5oGyO5ABQVF+COXwlgrEHxQarNfmDEgYVOiuvVrRomVr aE7A== X-Gm-Message-State: AOJu0YxNegVJt3CljbCFrHHdG+oyOryrFDNvDXT6ZnrncrNomvFWEkAI T3U74Z11tgFqL0V7BLwxHPIidw== 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 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email 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 (pete.vger.email [0.0.0.0]); Tue, 03 Oct 2023 02:13:17 -0700 (PDT) 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