From patchwork Wed Jan 8 06:57:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 13930192 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 5BB95E77188 for ; Wed, 8 Jan 2025 06:59:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E3B056B008A; Wed, 8 Jan 2025 01:59:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DEB3C6B008C; Wed, 8 Jan 2025 01:59:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C8B5E6B0093; Wed, 8 Jan 2025 01:59:34 -0500 (EST) 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 A995A6B008A for ; Wed, 8 Jan 2025 01:59:34 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 36953B0524 for ; Wed, 8 Jan 2025 06:59:34 +0000 (UTC) X-FDA: 82983383868.20.7F6384B Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by imf02.hostedemail.com (Postfix) with ESMTP id 66AAA80004 for ; Wed, 8 Jan 2025 06:59:32 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=I8MwC6rz; spf=pass (imf02.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.181 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736319572; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=qK7UmD8A9xmARwj2p/zsqM766rIMmkR9OD65YlbhPf0=; b=6KFg1AlJMvBhZp2QxNxTsCR0KLZ8J98P+B9qotTHaA0navzYEYIrd2WAap+T1R1u+XP/6w XUXvJ1rpvQtkgcv0ooOL4UiMc9BWg6X2MSn53nGS1Qj1wnZr/PQD4M68STzr6yTaVTiHJd uZQcHQgB/m8P2HjcdIKzBhUUDcoI8mU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736319572; a=rsa-sha256; cv=none; b=i3Fk8S2oFdFrL5B0Ozbxuk5unJCoZYWIy+w2EPnm5tZRZ7PYji47Ywy1hqmDr5x3+BxCdl gnlyQf9g4nZnKoQzdC9gPSNYuNTgX5mwGUa9PboE78gM5IucdMQ7A6+GkSw3CKu9LuU44j XgVs0irGcm8VKr8APU64cuODxa4urmE= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=I8MwC6rz; spf=pass (imf02.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.181 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-21a7ed0155cso22810315ad.3 for ; Tue, 07 Jan 2025 22:59:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1736319571; x=1736924371; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qK7UmD8A9xmARwj2p/zsqM766rIMmkR9OD65YlbhPf0=; b=I8MwC6rzjdrnS52laBMcfGAT3FaXrBxW117ffQWitPnFUqwV5D4XDz0bEyrIndtEE6 YgACaj9Xh1pW5dit/tijK47nIpOI5LGJlCc1gXTXIxr0F89j8vrF4CgU/1z3DIRW/J8m djjoZ29/MvqLZmupE0W5sOsCzPa7d/OQP0YiHbm9Ft2nM9sNK2Ihv+SYJUEXSfTuyCH6 l95bf6CJGI/gDM4HVAO+JblGiUyEuoVrZEKM+jh8BoGMSS57fbJ6zRoEPOIIIYyLZyjk D/IX8djpDKGpJup3/pmiL9MrVvfJkGmyoc908h/sYfdx9VAziUTIJnDXlO37cosKRv0g dR6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736319571; x=1736924371; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qK7UmD8A9xmARwj2p/zsqM766rIMmkR9OD65YlbhPf0=; b=JxM5IUd4DmeLQ3epUCruNwdPPSjW3l8CBLV/7GwmN/3RMwY8RkfXGWVgE8y8+AmcHa wzOR8jWO24I2Szj+cvzSfzZdm7Dy1sOmL6Pv/D2fDXL0lP//xeFvf3JPErBWwiPxZzaG i2WtyeOujAE5x6zi4MiUOtsmkPYtPpYYqRPXM5pB+ltdKnrFS55KABUKZo73xDrw0MZz VuAF578BJL6s3qbUEIJZSHDr3VTOmkmqE39N7lOKY7xoyHCKGJLNQUDtzMikIaU1D0CF Sevz45RpFdS4RJD/rX+/1wshDuwwyxTQI+KBr36dPaFvQ3lS7vWOQusBezy+jBQKSnNn Kynw== X-Gm-Message-State: AOJu0YzYTtZkWJleacHbWqc+eSqJdu8YERWv5Z8VYYabj60KuxVwFUuR J0DjENLtR7DKElBOQc5GmNYWDOmI0MxuVVGVHMYkG9HE+ZN2lxPHVQE0XartUQA= X-Gm-Gg: ASbGncvRbTQSjrMmJhaumGMFoK8ZBSnv0UAtA1YNDz3HawVr6Q2h3F/+vprVmHlHsK1 UDww+NTdozztc15RLNDUBE91lc82pLrHG7uVtdzgt1SHz8fEtqTx2axx+tXoefj/Fl2PzL1E7Ye JcQTov5vOMDbg7OBWGG21OY6jOTBktdfpajGkYJF6c5qUUNP9OyqEVd4VNM28/R8IC7HJsP/d0j 4FEUleAvc9HLeuLNy92BFuI9ITHJ0Nl1Abt6hAF0JsPrEWNTZ7s6uRAyktQAvQiCenFeunuBEvQ A20CuXEcxWntSOyLA08KerYFUZA= X-Google-Smtp-Source: AGHT+IHPv/02/1SYwL+5wvpHkGRfZSWRMZ218tgsJxwry8Gh8x8rNq2cUbRiuSy0SgfT7Mb+CNVIfg== X-Received: by 2002:a17:903:186:b0:216:34e5:6e49 with SMTP id d9443c01a7336-21a84001250mr22590365ad.57.1736319571238; Tue, 07 Jan 2025 22:59:31 -0800 (PST) Received: from C02DW0BEMD6R.bytedance.net ([139.177.225.244]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dca023a3sm320067275ad.250.2025.01.07.22.59.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 22:59:30 -0800 (PST) From: Qi Zheng To: peterz@infradead.org, agordeev@linux.ibm.com, kevin.brodsky@arm.com, alex@ghiti.fr, andreas@gaisler.com, palmer@dabbelt.com, tglx@linutronix.de, david@redhat.com, jannh@google.com, hughd@google.com, yuzhao@google.com, willy@infradead.org, muchun.song@linux.dev, vbabka@kernel.org, lorenzo.stoakes@oracle.com, akpm@linux-foundation.org, rientjes@google.com, vishal.moola@gmail.com, arnd@arndb.de, will@kernel.org, aneesh.kumar@kernel.org, npiggin@gmail.com, dave.hansen@linux.intel.com, rppt@kernel.org, ryan.roberts@arm.com Cc: linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, linux-arch@vger.kernel.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linux-sh@vger.kernel.org, linux-um@lists.infradead.org, Qi Zheng Subject: [PATCH v5 01/17] Revert "mm: pgtable: make ptlock be freed by RCU" Date: Wed, 8 Jan 2025 14:57:17 +0800 Message-Id: <366002e0af83f0d5cad3f356db036cb6447492f7.1736317725.git.zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 66AAA80004 X-Stat-Signature: 4uryyrx6afwzdb9d9ui5rnokaqtpoord X-Rspam-User: X-HE-Tag: 1736319572-523486 X-HE-Meta: U2FsdGVkX1/gKzlQrCPyjEoMQjOJUM/yJpHNihBIEn6kwJ3yJRK2bAS/hw3azWRrdUzv8fRv3IbFrgwgZDmCLfGbLE4F0mE2NYUvbDrZluWPh1Lzk4UKOnH25CryfnDkeOVoQExqcgXsIPBOVnEK88ccn9XxkchndguIMvG5+MrmcTYCEBdOXAj5AwvEmDiG0mN6v7+VL09S7ZGBpHEkuQPUXvWVik5X0pSNHPBOuaGDPxT/3tiobHS5xKuCBu3B5ZzmmCoRdao0iULEY9NertHzkcchNBy8r6rbCBo5K6eONczINUDcvBDgnQhG8FWn+BFy0pB/01lEHWkcuHPcrtk0+BW01iDj/oK/plfrSF8OX9B1NeWnpju/Scxwb4GwnUq7jA9FobH9rj1yP9wxDtWvBo0Z8m90r7LQOLziftzDn60g0JmJ6ymuORivgluqwkHiczWqjqELuYkta6f7Ik3VtexVXIAPsgnqHmFs7zRrHLZM9l9MCHBbjYI7v/pquU90kZZGoOfzcaq+iSV1k9dSejVS7ClYYMCZcQgQm0h+kC00ZYzU7xmDQbE6yXBsex5HBwlEViazUPaUMeXk9q/CgCmH4JiNwxRooY4iXc+2mRycPwBdvNVVqesjY9BR0A/fr2C/bbH+41TJV5oT41S5lgp3h2rvKB6O53aO06IpIl+SasuLqljD03aej9AAzorW367ZnzI8nURGyZpXvNKL+yIIj0wJSE+ctJABCvEfQF0u8Ng4eJRuULBWD1g6RqlWPLrG5SmeR8N0rh3KOcZAPNYw1x6556oU3NGLN/qy7l/YLZBXVCRrmuEctAOZeDKkWZkrEL3dTryt40rXmLnAIp0EGffWiY3S3+15OnTa3sVg/pd62BwYg9DoBNCJaoY9AgPvCU0JGdyOmhFTCg+ZyT6yfLzWGMz/8UpXJMfO1M3AyJgfk878cS/VG8JkeO+nIifhRbOQEyDJiMt Xi9uJl7C AYCokvlOksn64IrbRHuWyyFLWV9h8dTmCNgGXmXF6wcRvbaP8Ap6Z4598Mbw+OrhvqxQm0qq/eqKkZY13/ZwMAiKvOp9KmXJUY8rbO9u8KOb9A8d6ZS/nXhnpFHphVT9AM2eyTfrFF41cB0FOpJ5Lo/0odKowJj5lcNw8+A7jJcQeEqONcskaG8HbvTOTDyxFcfpTFazeVcLDsq2OilrPBTU4SVIL+qCyBugNSTIWKZtKhkNhIjcPwdBGrVSo/MGqnJajuGODMS/DT26frYQomZ5kKngUeEYqVe6oQLHcOXsCXigaUopGha0zAMLLBcdVl68Vmdq67OIgb9TomC5FHC4v5GqlpqPPqY9bnqnXaTaN1jGwBNvSkp6aZEU5p6CiByoKrrj/kBHNbt9o1+O+hSYGHEeTqZxf3qXtkicC6RoG26PK64y4sxeoLw== 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: List-Subscribe: List-Unsubscribe: This reverts commit 2f3443770437e49abc39af26962d293851cbab6d. Signed-off-by: Qi Zheng Reviewed-by: Kevin Brodsky --- include/linux/mm.h | 2 +- include/linux/mm_types.h | 9 +-------- mm/memory.c | 22 ++++++---------------- 3 files changed, 8 insertions(+), 25 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index d61b9c7a3a7b0..c49bc7b764535 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2925,7 +2925,7 @@ void ptlock_free(struct ptdesc *ptdesc); static inline spinlock_t *ptlock_ptr(struct ptdesc *ptdesc) { - return &(ptdesc->ptl->ptl); + return ptdesc->ptl; } #else /* ALLOC_SPLIT_PTLOCKS */ static inline void ptlock_cache_init(void) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 90ab8293d714a..6b27db7f94963 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -434,13 +434,6 @@ FOLIO_MATCH(flags, _flags_2a); FOLIO_MATCH(compound_head, _head_2a); #undef FOLIO_MATCH -#if ALLOC_SPLIT_PTLOCKS -struct pt_lock { - spinlock_t ptl; - struct rcu_head rcu; -}; -#endif - /** * struct ptdesc - Memory descriptor for page tables. * @__page_flags: Same as page flags. Powerpc only. @@ -489,7 +482,7 @@ struct ptdesc { union { unsigned long _pt_pad_2; #if ALLOC_SPLIT_PTLOCKS - struct pt_lock *ptl; + spinlock_t *ptl; #else spinlock_t ptl; #endif diff --git a/mm/memory.c b/mm/memory.c index b9b05c3f93f11..9423967b24180 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -7034,34 +7034,24 @@ static struct kmem_cache *page_ptl_cachep; void __init ptlock_cache_init(void) { - page_ptl_cachep = kmem_cache_create("page->ptl", sizeof(struct pt_lock), 0, + page_ptl_cachep = kmem_cache_create("page->ptl", sizeof(spinlock_t), 0, SLAB_PANIC, NULL); } bool ptlock_alloc(struct ptdesc *ptdesc) { - struct pt_lock *pt_lock; + spinlock_t *ptl; - pt_lock = kmem_cache_alloc(page_ptl_cachep, GFP_KERNEL); - if (!pt_lock) + ptl = kmem_cache_alloc(page_ptl_cachep, GFP_KERNEL); + if (!ptl) return false; - ptdesc->ptl = pt_lock; + ptdesc->ptl = ptl; return true; } -static void ptlock_free_rcu(struct rcu_head *head) -{ - struct pt_lock *pt_lock; - - pt_lock = container_of(head, struct pt_lock, rcu); - kmem_cache_free(page_ptl_cachep, pt_lock); -} - void ptlock_free(struct ptdesc *ptdesc) { - struct pt_lock *pt_lock = ptdesc->ptl; - - call_rcu(&pt_lock->rcu, ptlock_free_rcu); + kmem_cache_free(page_ptl_cachep, ptdesc->ptl); } #endif