From patchwork Mon Dec 23 09:40:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 13918641 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 46F0AE7718E for ; Mon, 23 Dec 2024 09:43:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BEB8F6B0089; Mon, 23 Dec 2024 04:43:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B9B686B008A; Mon, 23 Dec 2024 04:43:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A3CB96B008C; Mon, 23 Dec 2024 04:43:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 8569B6B0089 for ; Mon, 23 Dec 2024 04:43:21 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id EF84C1A12FE for ; Mon, 23 Dec 2024 09:43:20 +0000 (UTC) X-FDA: 82925735046.16.B096414 Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) by imf20.hostedemail.com (Postfix) with ESMTP id C13F31C0011 for ; Mon, 23 Dec 2024 09:42:39 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=aftQnd9y; spf=pass (imf20.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.215.170 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734946963; a=rsa-sha256; cv=none; b=OLkxKyxCN4K/SQvv18OzoOQlyEcoQpyUWRMiR9+pspn5jH/3I8ObFDPKOe1Yi6HJbslYxk Sda0Xs60huQa6u6FU9hTHpk/tNyRfAFyBmBuL/xCgCaSZtSe/XKfjfFoRhtoA9ICKibTrU gYiHJ6beyi+y5rQgZa7kDoG23mvaPlg= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=aftQnd9y; spf=pass (imf20.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.215.170 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=1734946963; 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=SyzxI6H4ZAISLyWZ1lhQ49SW3wSD1SDR6GIh5AHA3wQ=; b=hLzEMK3Ygz5XKspz3vzcNMDpRIxLGcxPW4pvh+FNmWvwTebvICczCHrpIG5zHYEP2i29/G UBla1QOpW3VvCNlNwTHUn3GnhzsNkspcUN7mKCGf/C/nfpz++GVh9QL1sEQRX7wj3GGW40 kGZq8eI6I8xxx50Y/Fj39AYnHT0d2pY= Received: by mail-pg1-f170.google.com with SMTP id 41be03b00d2f7-7fcfb7db9bfso2727466a12.1 for ; Mon, 23 Dec 2024 01:43:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1734946997; x=1735551797; 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=SyzxI6H4ZAISLyWZ1lhQ49SW3wSD1SDR6GIh5AHA3wQ=; b=aftQnd9yIyNi4bUqNdGkW3xtWWMl511IdBwRf1kA1GOc8DLtC1FigDlPRaCC3vsDbV qCUUwAOyWhpuI3JnQcz7g7N2P7hZW7+BL8OZ/nuSa4j3mSCzc43ZC8vB+ba/CDr2zRvS XhzEsVazCdwHJ+ZFm5upN/6HO5ZG7PoiKTTwuqzQf3Riip6nuyXGnNrVjpBCSxc2kMYo kj3VVAEatzR6oCKVK0ngjdetgvafOiqUpbdP+fQ+dZKe2fXeKPohEScRk2GSrTLH7TBR 0rloSsNN67pbkttlzDWM97z16Gx39HvoMScgAXW42EFk6CqrL/H0cNwYeIXkrHIrYItT 1aWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734946997; x=1735551797; 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=SyzxI6H4ZAISLyWZ1lhQ49SW3wSD1SDR6GIh5AHA3wQ=; b=TeEGQgRSvTmC4nhWYRAuPc2oUTEP4xOn9m//3cOZ4qPfeTIlMUzCR8QEbojEhdugjC 2dcWqscrtF4I5VJrILMHyFdrdrNcgNkyREuI0tIg6IjrLEoy76XFwgzPCVbZhpE9+6fM OxYzeJOZRI9MqAmJHu4kMX9MCNLx/RBm5fbWb0KAZUXX/avllotP/zdOiNV8jAkOlhBE 7jq2ieorgVeWwfZUdrWx9FpgvB16gQMRTHPmCozIwQHFecjTMT6Xwche+rDmo1xCtzrn xUThXA6+wE4pkG34dUF63HfMlZLQwTLSSymSe9RpMrDpOpSlU3kCnt9aW4WHhqisTj7o T9Vw== X-Gm-Message-State: AOJu0Yw/Kz6Ol3rhUxK4Ktg2KSa1tOlgWzZ9PeFZ9XvZlaq+LhPvxgA3 JHDKj7Wo1X8PG5xspv8Lpi7tqF9iXmd22W1eGw0TW7ZxfBrzfJ+tO3ORLS1aUj4= X-Gm-Gg: ASbGnct4pjVxjnhI+AkQ0SpVKpxuAjRr62pljpBswQbY2PBleVTTgo2yVqJhfNIknjT a5Mp4DaDSaLMSoVJW8Zfs98RZCC+cXLMC1UlPLzngoxVjXGC5yec2CYwnj2HSNO4OwcaXePFRCI 487FluLFxvcAuSa7dOJny6I/7HL4taMwe2x/hG1MNBdU24JyXitp1xroGdLEq84u2JZZIh/yrGP z1fhokWsdAPYS9oyuvAl0AR75Km3k/Ql80rhlCJ9K7358veub5ErwHno1kzoBc5QsZEOfBoQKuA xE/rpW4ZrT3QH77lyH0MlA== X-Google-Smtp-Source: AGHT+IETS5CqVMOZwuklYBKyw2d6q7hBKdfBjuJ9ZQ+tZcvMnTE5pZk49SgpvcM01OaAXbZV7hq4vg== X-Received: by 2002:a05:6a21:6da9:b0:1db:e338:ab0a with SMTP id adf61e73a8af0-1e5e0447f5bmr22664720637.8.1734946996090; Mon, 23 Dec 2024 01:43:16 -0800 (PST) Received: from C02DW0BEMD6R.bytedance.net ([203.208.167.150]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad8486c6sm7468309b3a.85.2024.12.23.01.43.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Dec 2024 01:43:15 -0800 (PST) From: Qi Zheng To: peterz@infradead.org, agordeev@linux.ibm.com, kevin.brodsky@arm.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 v3 01/17] Revert "mm: pgtable: make ptlock be freed by RCU" Date: Mon, 23 Dec 2024 17:40:47 +0800 Message-Id: X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Queue-Id: C13F31C0011 X-Stat-Signature: f8aobcanao3b5pxx8mhjfkps6xr1onxk X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1734946959-590350 X-HE-Meta: U2FsdGVkX19+g3D1wiNEUm6KJybOHFucjuEFysvlv0PH5u+qapQf14Sl0yph6dmwDhf0oBB7adygkiH8CHnLM3EjYzMZzYBX5k6DmRwfpf9R3s0zHpVUtj8UrdhVAt0T4hplvkHbegAQGgE0AhLRAo+dbygJBq7YltfjBs4FU9Q600e1CJz2eQDWGdkrlyGcSgU0q9VzusEseHLf4+xgix7cYz4LGuevokGxNFueya43DcTKldoj5ZnmUOicZaHE65+0eti2TWU4aCmFB0RBavqN4XpD8t/pQy/6o0dVQKKnXfkOmbkWLBm31X4wrVYFZuxRqlW/VbDk+uCzz8yFsbKIKG7/dfZRltrCWZcRO5gZGGSqELTgfHRnti+hpb9YAT4RmSmZHiXKy7tEwXdak4X6hVbyinWAwjQ7Q/Elwa0GQbvMOTmIIwI1PaJK1fnIu0dbpk4ixlUGxMYQrgvDH4A4553tDCtEKLdkqemTzuwwXZIuPGjiUY/+FDoXc3IBmu0g//halVp3Om7GJWgHwJdXrDS/RUxTo9kMlT16mhuiAXAI32Hf506WfWHJDjygCq32B4MUppzelxzTXElfld6joJ7cCWT9Pi+qP5GtE2V0i7Bt1pJkA/8o3ApzRp63km3rUd0oG3ttGNsvwBagcu7vH64a+0TN2H+Y4i9kDVVwZw757l4h9N5RH8+s4J928ymMiu9MgUFjYwT+y07qynwmiD+JadXo4qvsSR9upOarZ4Rg350pJs/XWeM372qJQq2h5ginN6f8nROZCMBUE8ZjUi6uUWE2HJZ+VIO+r0CzBcvwBD/zySntVd/JJ1+U/0mEFXCOTTJyFAn2a1oA3pF29Y6ZcE7kBJ9FYTHbviQZ9T5VoBx1cCodx2EnRjlYyCETC2stwwDbnz+Y6FP1qqrJRtIUKmLnIxsGcU0vqaDV2GlAONYabp47AoBtL+ua52WjoPv4s+epFcew+uB QqfurSNN jPEdH8m+K3lwWXCE215v2QbDTHd9W7lXxDxS5oZ31W9mPoBE/2QEOLiaWCwE9NhR3fHH3dNxFSgpai4kDwJhHxl5zwN39sEtIShSD2GO8V5rI1EfO5YYM3Ojx//ROIgOlTSFbf0GmLWOCsjn1iiyKNLle/pEZ2ZFHBy5S/IJdRNdyEcvWi8MFndZ1ceHW+Ej4ktMYeR4AQnPSo2RjiU55hQfhADLA2Y0rw4fknS9Z7LIYp5DzeF/3K+YN7Y4eusvoyd7meNfiQkJO6F0peRB3y2NHsD+ON9kbGU/uaFfwwIT7W3LbKAOEalsYT6xC6t4eGqholJ18VPzgcGqOoCWZQ1ZCSTkF9fyDeGQoDn6gi6nrFOTX0am5FET+BEdk8tiN3sFM X-Bogosity: Ham, tests=bogofilter, spamicity=0.000004, 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 --- 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