From patchwork Wed Dec 18 13:04:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 13913612 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 95420E77188 for ; Wed, 18 Dec 2024 13:05:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2DE906B0085; Wed, 18 Dec 2024 08:05:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 28F516B0088; Wed, 18 Dec 2024 08:05:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 12DDD6B0089; Wed, 18 Dec 2024 08:05:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id E4F3A6B0085 for ; Wed, 18 Dec 2024 08:05:17 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id AC1861C7D7D for ; Wed, 18 Dec 2024 13:05:17 +0000 (UTC) X-FDA: 82908099414.06.EDE1649 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by imf05.hostedemail.com (Postfix) with ESMTP id EFDE0100018 for ; Wed, 18 Dec 2024 13:04:14 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=KFZ0pK9y; spf=pass (imf05.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.180 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=1734527094; 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=37d3136MH/Lj3ZUUrUTIyNwrWsJuTyPww/s07XJQrz8=; b=5b/zKLvWe8rSn3P/6aaI6UQ7YhubQXTPnyGrFfkHcavg4R4tnoI0uIYmrX9zOhDNGFTna9 j0iGfLk5T/vyULtsLUbrWGv7PwLNSwXidHIdEwtEkJlOUry2lIDj0byqIy2mZmeCPY64zh kJruErJmnYwoVmluTU3JJJ2rKJJJkzs= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=KFZ0pK9y; spf=pass (imf05.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.180 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=1734527094; a=rsa-sha256; cv=none; b=gxNJS8a2bw1agASkrwHkyfuDeXwQu4VSWjm3KB6v3LiSb1eNy70IEEh8ggDpR+DUljyuH4 MqPFgNYXxvbCI/WBRZ/X37pdILjeke6Sbh+dg/WVrq709Xi/H15wcTVOPPUyoil8JuvXn2 LW5agIUALj+HSYgdUMZpypPUllUI9bA= Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-2165448243fso63062045ad.1 for ; Wed, 18 Dec 2024 05:05:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1734527114; x=1735131914; 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=37d3136MH/Lj3ZUUrUTIyNwrWsJuTyPww/s07XJQrz8=; b=KFZ0pK9yykL8IrCU4q/f0ijWRzWVuNsFbeZxm7rV9/YqTmNuhMGrCL7qzITJkNqC++ ZI5lytMnzeIyXtJgnUpM+p+CR4fxEbeG2TFabgboy/CFIBYI/kDsM9XM56TEG4VdJLLi WBPLlQOyZ2ilJb0YryZLYFV2Nh2MWGzzffcO04wdLZhS6rIfQEjBuUODjz1ONuYmJZfq 7UVc09UOsU+veWk4uUo6xUbHxCPERBAOEY2POV3WaYBN4XPtZhIT9eb11L5EGtXY4/iA 8HU0ZRCHIhWxu7bi2AeSVexueblfNJ79pgsNiurRfLr9m71emYWDtttcdO7azOJ84Jlf VmAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734527114; x=1735131914; 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=37d3136MH/Lj3ZUUrUTIyNwrWsJuTyPww/s07XJQrz8=; b=OqF87JkgCqsdGSJ5pqMrA1lb9opbWjo747xBZr/EknFPNSvLTWSb7+GobxsH8af6Yf 3g63rKy5R9VPNAolBHrzaszV6AdoZjeE3wKP4qZq7r0G/1D/pCQQ7anN9o7SL/eJ125H nSmgbP6jIZflWMNCA6L7yvIehm2dvvx5kgh4cG5lf0biYy9z4D4pIVbrSbGWgs8iBHzG ZdfeD/kGKJM1zc3cWitWN17Qp7YLzqCKgiaP/6aiYlv+/g1Lf952dixmBDq7vhviOX0d zCC+MQZzOqffm8WiLGhwlyz7pB52V16WQ07bzcCG1HGDamnJQITgqChjPrez6C+UOi9X aCJA== X-Gm-Message-State: AOJu0Yx7lByeFFeECqybrNA2nk7HwCBFdPunyaiFjmcPC6UJHusuxJMX e6bDWoif6AVLphFrgQJSvy0sLiBmYQtovBuAa5/TJnGI+AZObqJ2z420IYXSqHQ= X-Gm-Gg: ASbGncsXdA8O+bDvvfT5hZekfKEDHbkO8a2Pg/b3MAMzi1nZIz8C+Z04/YjTeTsQHGD gSu8rSnfJFfR4FyKwgzSAYhfwjCO1BXvQVcOdCHI2RgPnTq1ftqTRW1AgARaGT0jpJaUgc/RRGW XZ6r1JhIZlXP9ddSWY3kHLMSORjU5nOBUzsSIPiUT6lBJ6kDCPTt3K6QKEtItTrA16sF7MyDSXo CyNXmfTqJWF/dKyTpAIJ1rbdchub/1SH8OKeVoMphJ7TaxgUuDIqbIdUJj5eK4rwPxGd62ficH8 bOcagXewvj2CLhJ15USu1g== X-Google-Smtp-Source: AGHT+IGVLgY8vFLZqjIL3oQPZehgU5XP1d4YxVu/+EapWtzKcY/+w347Rqmd9s+hVdjxdsfNE1spFQ== X-Received: by 2002:a17:902:ef0f:b0:216:6855:164 with SMTP id d9443c01a7336-218d7252ae5mr34612065ad.39.1734527114526; Wed, 18 Dec 2024 05:05:14 -0800 (PST) Received: from C02DW0BEMD6R.bytedance.net ([139.177.225.238]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-218a1db755dsm75751825ad.42.2024.12.18.05.05.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 05:05:13 -0800 (PST) From: Qi Zheng To: peterz@infradead.org, 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 Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Qi Zheng Subject: [PATCH v2 01/15] Revert "mm: pgtable: make ptlock be freed by RCU" Date: Wed, 18 Dec 2024 21:04:37 +0800 Message-Id: <914f1b9359d5547c08a30908e8c970fdf463e210.1734526570.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: rspam05 X-Stat-Signature: k99zqogzrxzxp9t5f4bbpdjb9ezzxr58 X-Rspamd-Queue-Id: EFDE0100018 X-Rspam-User: X-HE-Tag: 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7wsR8pmkielN2dMac0rIRWGl5J6lCtrjJ00jl+DSgR8UTXwCzxaV1W3GnH2/AyhO40j8Z/rQ0CN/AKkwBtLn7eYYTlQ+pGPvg5fgu74jWE1GPQ91MI0pC4/o+vRegUW1NSuxWzxCYryKSXkmH4bIYnyPjAZ9ZqsiYzzZzYn1Z3en4poqadaUCtIbwKqzOE2vbBc4o+IetqshAfImS523o4RyMxRWUCtNPHBrJ8GVfU76yibFMzO83ONE/wUAPZOOE5cKerh7X/NPM4mAbVreiAAKxHJdGoN9MqcIZPIU X-Bogosity: Ham, tests=bogofilter, spamicity=0.000045, 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 024bfb3ca9152..9d58f89e9643e 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3019,7 +3019,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 f73645627fd92..e2139af51e050 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -435,13 +435,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. @@ -490,7 +483,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 fed097ebedcbc..e064f5edb7c56 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -7087,34 +7087,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