Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp821400rwi; Wed, 2 Nov 2022 19:29:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6yqCc3DgoOAtkVua+gqCVEWQglluOZrMmpw17OxR7ZsbBjxEbbkUimknWVf0pWgZaPsSLz X-Received: by 2002:a17:906:3406:b0:7ad:a8c3:585d with SMTP id c6-20020a170906340600b007ada8c3585dmr25835623ejb.573.1667442552755; Wed, 02 Nov 2022 19:29:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667442552; cv=none; d=google.com; s=arc-20160816; b=eBp9oePJxru3/GQmFAEV01iKTzF4xVT9klRQw2wQ2jumkd8HqGkk0Xx3IFfL3OhDST KQR/IbV1vu1ANv/OTNNqgUNVKtJJpUGt74FhwlmqizMY+286dfF9lx4FANcidebcr+3i 53dZGfdNmvaVCDL/2hl0lAMGM0u5fNBcyMb7gKgUkE5vfAdJndAyU8KPB2NbZUAuLoiF n80dONp7kvMO3kZC/Np8cqA1JcEXrgEX/6/6qB80oSSap3foVrlr7OP3tUjRS93DzTp+ z5pjkesWwISGiJQaGVJ7kurBb6ToZujI6iUaxsy8xiAz72mfyomvWh2DVgrM+V44Ykad 3vcQ== 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=Wf7K6DzyqqBjFrezQMeybffBuwbwWuOxP9c2dDDBwRA=; b=gR7rW7d1pwIvJZ1Vue8b5uBrmSho+F02l2dcoUyQc0vSXuhHg3mi58DPUwv9HsaDjO 7xsxe5d8u/V9WmXHznAePC1+Hs+W9OBLYRzzVGx1RHl/xGyrAkxlepr7X4EPdEq9QdlG 650Z7nsO36ADcI1RWpYz+G19fqmhL//BAfdZu3Gp13FwgJdGjAriOkU+QUHI4LGqgcbs L/Xm7loC2toSbX+55d9YId5+/ZpebtFj8pe7EXpVri1WohTm6QupIZMK5uvaklwkx90F t5jxW1csyZTg/q6sCkVZwdxweLTX3EGTQSEcMWE2sw6ThOmuuSuLpD/o4Xmwdv9MgaDA BWsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=INoLVtvk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm10-20020a170907948a00b007ac2daa0b49si18227402ejc.367.2022.11.02.19.28.46; Wed, 02 Nov 2022 19:29:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=INoLVtvk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230254AbiKCBpL (ORCPT + 97 others); Wed, 2 Nov 2022 21:45:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229770AbiKCBpJ (ORCPT ); Wed, 2 Nov 2022 21:45:09 -0400 Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A718912616 for ; Wed, 2 Nov 2022 18:45:08 -0700 (PDT) Received: by mail-qt1-x82c.google.com with SMTP id c15so452857qtw.8 for ; Wed, 02 Nov 2022 18:45:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to; bh=Wf7K6DzyqqBjFrezQMeybffBuwbwWuOxP9c2dDDBwRA=; b=INoLVtvkga2hOnf6CXSVVi7qkOYjUtycEaLZOhN97m6SDyqXTmXB4AfnKKFeD9FTar wMDzfWicgjZyRiQMU0f7JMvKfE8CDGgy75IXPLKh5/Xa1WAcJauS7opadb3GTpAVhzzk KagULt7kZz+MSzr1+/1Umnz8A1C068b3SKH4MMzEzO0iY6e6nlIgti16PAMzQOgZjv0z pQc105MhQhS2Ukc1xrJKcNKPW2KCM4/Met1So6rs4v58FOUG56toyZrs+alPsSBNXYxx 3m9dVPfRCjlbP8nXudsQxnSsI7vJYoVbXAn2ehpYrSya5ROpDrMbmwOs9Z+2kSZUdUdl OcUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Wf7K6DzyqqBjFrezQMeybffBuwbwWuOxP9c2dDDBwRA=; b=FM1NEGVaP4o3fBzzh5RwVmBn1VxQAkcEF2qzDwqhGmLwYiOXokoaAXLubiWIzMahEx 4/IesZs/faINK7pll46ZhI7SDDfG+fU2XMRMXo48SAVZi1HKv+0lTGajxyzTITcQD/ro aFhgYrwL3lLqjcCOCHOKuvCnxWfjZv/hJlzlrJwEdci39v8ziEHC4xF81jSNPJom3vyP ByQYZJWe962W6hNU4vKwN+P4zKmh0NLQSaEbELERGhXbEar2JglhPpAdTYuLWmHRYQPK Dhv1b6MH/hS1jU/xIq+b0I3jSYnS63e6uDhP6su74c1KbZ8PqS2jmtmht16pZpu6RW25 aNxA== X-Gm-Message-State: ACrzQf1DeO63W8/VJWc9Qy+++dWj6wAFcl6rwnqtHhvjVVJMUTsULxg/ eIXUt3wzrsn5Wd5PX1zmOPGBYw== X-Received: by 2002:ac8:4f57:0:b0:3a5:5191:b34b with SMTP id i23-20020ac84f57000000b003a55191b34bmr701662qtw.111.1667439907713; Wed, 02 Nov 2022 18:45:07 -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 bk20-20020a05620a1a1400b006f3e6933bacsm9777239qkb.113.2022.11.02.18.45.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Nov 2022 18:45:06 -0700 (PDT) Date: Wed, 2 Nov 2022 18:44:53 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Andrew Morton cc: "Kirill A. Shutemov" , Matthew Wilcox , David Hildenbrand , Vlastimil Babka , Peter Xu , Yang Shi , John Hubbard , Mike Kravetz , Sidhartha Kumar , Muchun Song , Miaohe Lin , Naoya Horiguchi , Mina Almasry , James Houghton , Zach O'Keefe , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 0/3] mm,huge,rmap: unify and speed up compound mapcounts Message-ID: <5f52de70-975-e94f-f141-543765736181@google.com> 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 I had intended to send just a self-explanatory 1/2 and 2/2 against 6.1-rc3 on Monday; but checked for clashes with linux-next (mainly mm-unstable) just before sending, and fuzz in mm_types.h revealed not just a clash with Sidhartha's series, but also that I had missed the hugetlb usage of tail page->private, problematic for me on 32-bit. So that series was slightly broken; and although it would probably have been easy to fix with a "SUBPAGE_INDEX_SUBPOOL = 2" patch, that would not have moved us forward very well. So this series is against next-20221102 (and hopefully later nexts), with a preparatory 1/3 to rejig the hugetlb tail private usage, on top of Sidhartha's. 1/3 mm,hugetlb: use folio fields in second tail page 2/3 mm,thp,rmap: simplify compound page mapcount handling 3/3 mm,thp,rmap: lock_compound_mapcounts() on THP mapcounts 2/3 and 3/3 can almost be applied cleanly to 6.1-rc3 (okay when you are on 64-bit): just a couple of easily resolved rejects. Documentation/mm/transhuge.rst | 34 +--- include/linux/hugetlb.h | 23 +-- include/linux/hugetlb_cgroup.h | 31 +-- include/linux/mm.h | 85 ++++++--- include/linux/mm_types.h | 91 ++++++--- include/linux/page-flags.h | 21 -- include/linux/rmap.h | 12 +- mm/Kconfig | 2 +- mm/debug.c | 5 +- mm/folio-compat.c | 6 - mm/huge_memory.c | 37 +--- mm/hugetlb.c | 2 + mm/khugepaged.c | 11 +- mm/memory-failure.c | 5 +- mm/page_alloc.c | 27 +-- mm/rmap.c | 359 ++++++++++++++++++++--------------- mm/util.c | 79 -------- 17 files changed, 401 insertions(+), 429 deletions(-) Hugh