From patchwork Thu Nov 3 01:44:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugh Dickins X-Patchwork-Id: 13029388 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 20550C433FE for ; Thu, 3 Nov 2022 01:45:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 407C68E0002; Wed, 2 Nov 2022 21:45:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3B6A88E0001; Wed, 2 Nov 2022 21:45:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 27F918E0002; Wed, 2 Nov 2022 21:45:10 -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 15C608E0001 for ; Wed, 2 Nov 2022 21:45:10 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id DD09FABC1B for ; Thu, 3 Nov 2022 01:45:09 +0000 (UTC) X-FDA: 80090437938.14.223AAE7 Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) by imf15.hostedemail.com (Postfix) with ESMTP id 87641A0005 for ; Thu, 3 Nov 2022 01:45:08 +0000 (UTC) Received: by mail-qt1-f175.google.com with SMTP id z6so466952qtv.5 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=7j/uUFWYrLc0OxjK8eeOWP+iPLCYZ+VS2b24hby6DSVxBrfIR53NuDaG9d7tNOTU+O EkRpRaahlTX9zf44hFzFqhcgO0D7WkVp3OaGAE+24WwC761BZL3Ierv4R/x7cRkcDOqJ c+hi4n9cdGCUvixz4YoJlEfad058OPpgyDsjhYqmGch2mdY37elQ8kCgPk+O2hS6zQeC QJJsJ8JdYfSj/U/6kxGtN5hVdrBWlDTXkyittvKKReTqO1xj4UKC5D8Ge7dyhcAaSeuZ Wg8eHHLdiNNJ9MXoYt7twj9R9gYc8JBaNoiuTHYWz3oWmrAvhH3KXAYOrmCIV+s7PWGe Wazg== X-Gm-Message-State: ACrzQf1w5wxZfDnas67SfS5j1x4pJVmxUo1lAIpzq1PAOfrz7X2oxXOe l+H4kufWNImqMILMsl9hXLyo/A== X-Google-Smtp-Source: AMsMyM5fS44QwhRBsL6UbFlEOiI89VgJCALTzt6SQxOeXhsODaGtGfa8+4FGBHJaR+CDeqH38mhr0g== 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 ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=INoLVtvk; spf=pass (imf15.hostedemail.com: domain of hughd@google.com designates 209.85.160.175 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=1667439908; a=rsa-sha256; cv=none; b=P9bUQIFEGq3FhP+DqMM54V/MO2KzO8Y/1L+3iJTOtUoaO9WVI8RenAVcDslLYwHRGVCZ8r bI4V+b8uUZVEDIBrfdq+wbnND4JgxCv4My5lN+cmoKsy1//H3xgAQqN0TFKvzI/n9YzVB3 6daz1YheEf0U3/paZREBgBs/1QrbWuw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1667439908; 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=Wf7K6DzyqqBjFrezQMeybffBuwbwWuOxP9c2dDDBwRA=; b=wrzE4vuWcLn2OI+G6oLjTZEMpOdIK8BthW5CHR3vLXGAoG/XT/GbwgqVixg9k0VXsog3RD QnWzUOs1UsJtM2pqJGvK7uXVsfRMC0G1mgWjiOLAaRrZTVq8mIrVc2+M3TSKaquuToQh91 9lTLAJFlFvsqrYDFRRNTxhkSihMUKQw= X-Stat-Signature: fxhk9brrrycbo7kqgwnf58afqgbphotm X-Rspamd-Queue-Id: 87641A0005 Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=INoLVtvk; spf=pass (imf15.hostedemail.com: domain of hughd@google.com designates 209.85.160.175 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspam-User: X-Rspamd-Server: rspam12 X-HE-Tag: 1667439908-615071 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: 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