From patchwork Sat Dec 14 09:02: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: 13908426 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 F0441E7716A for ; Sat, 14 Dec 2024 09:03:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 851726B0085; Sat, 14 Dec 2024 04:03:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7DB286B0088; Sat, 14 Dec 2024 04:03:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 62CE86B0089; Sat, 14 Dec 2024 04:03:50 -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 4163C6B0085 for ; Sat, 14 Dec 2024 04:03:50 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id B1D8E161C6E for ; Sat, 14 Dec 2024 09:03:49 +0000 (UTC) X-FDA: 82892976684.02.F274B33 Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) by imf19.hostedemail.com (Postfix) with ESMTP id C83421A0003 for ; Sat, 14 Dec 2024 09:03:19 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=QJcH2e1y; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf19.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.182 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734167003; a=rsa-sha256; cv=none; b=FkKjNlWRS6T84T1WtHdY3Hsg9qBxSBhOrl6iqNQzaAuRBULR+XNoL1j8vxxVgsXj2v/MGL 1sJWVtR2hPTi0ULfLUFCDDYRfpxdp8iY6AFxpJfPOqPLCR0XOx/rtHqipMzwGVZARiG5rf L+tEbQ1ubfniQaRoUSl3whyTCjIjyNc= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=QJcH2e1y; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf19.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.182 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734167003; 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=/W0KMvrB9Jil9zRQ2f7XfdU3YONHwHkiAoiFljp+njo=; b=NZB1TROrPUO2AfbVIB5JVInCjdxIpQSvq0+2RqnyYpoVJcV2H80rmuClLCWd50A5/Zpi92 b6wQ8zqomi6TfKUWdnwyXuuFI5Z31jpp+T0s1fyzuJxD9ZcYSz9w80U4wsQ2Z0drdCn7uS o+euWFn+Gu0njxlGV/8doUga/EOfLHc= Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-728e3826211so2067039b3a.0 for ; Sat, 14 Dec 2024 01:03:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1734167026; x=1734771826; 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=/W0KMvrB9Jil9zRQ2f7XfdU3YONHwHkiAoiFljp+njo=; b=QJcH2e1yCfU8BaYky5MqmWHgzmeKIS6cgtkrxFNudAKgyjgWwVMhqteqqYhgmOw2iS UqPtQj0D9pN4dQxI+gaynR2yNtP7/S5nYHWeIfA3qHZsGP60h2JxeynefZLFlkNbO6cm MhfW9+PYRs08GJqADZ/qYCoBAZgCmz6YMVsS6kYup8wOIRCFTTCsJTwN9my/U+ZJ7JwP YMEa4zEd6Q/G0SE7Zd7iGkaRwoeuJ4oZD97HYRPMW/UMUB++BvDtCyuT90r+sRehwby7 Tl7FiBcrBtvU3pSMBlHO8mvEzrplQrgqlNA7F/BK4sa5Xja7hG9vEvU31GWAW7SY0mxl tawQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734167026; x=1734771826; 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=/W0KMvrB9Jil9zRQ2f7XfdU3YONHwHkiAoiFljp+njo=; b=SR8MfM3imWzrFajhKc18+5ztaQDZIqwW5Wdj7Q69lSCxcB1qxhnYJ/8xN47DdWNN8N 4ziZN1pzfxiExrnvJ6TDlXCwYi/zNaujIHesYgdQbdaWkGG0YVFIVIHca4XsBqqrXGQW g+wZdtmU4eKW1vSuU3FKEbM/SIHhZf4cZwsJabn2XvjYZgrfxBDunvReUw8FmrpbkMYJ tA60zR1FkOiyYvhKMNhCQA1zOD8iIuhsqMIugpvG1l06RWYesC2GsZ/2gfvnpLQf4sF2 OAueP906fZllM+4eUYo1poDuN3YRQu28vaFCkLXUvMpMRj1CIWE3fH3yfR8bk2Lv5T2n mB1g== X-Gm-Message-State: AOJu0YyvhL2Sl9hbdKPjb+obMKefssw1I/uDtaXHZU4lFPTzAP+r5BSx sbzlHa3tfZp1lW610t70uBO8JQKRfyEbVn9vo6kILTkHe+QIvJt+xlPjaqxPIbI= X-Gm-Gg: ASbGnctM+BZv9xX9ELwXq7t/riJ3wpIBSHHALKiHg5ikQtWPgQ9CG0yEy0EcphOrfTW J/S3sj+G9683YlO88aQzvyTT/x0NhfazqE5n4Of8s5kIJt1KKPdCEXADIgs3zDR0kMXkO/7maVA pzTZm+QxpX8hrGSEenkfJ3izN5P2YAhQilk2sm5itxxZ29iddufG07b9V28o/yFOjsbF/HJQ4Ia /haixB18aYVyJM5w/j/b8Uf/Yo4nEd0n2N/o8ccGLCARjNryOwMUFCojihcESopTC9rnWysmY5X kVQFI5SgAREXgu0tSRDCdntSPqGlew== X-Google-Smtp-Source: AGHT+IFq7u9PWr4pIiPNWcOSLFRHni+qPQ4ESKUOWoSzAEQHr7L/XMr4iW3HNmhbkmKWJmb1Wl5pRQ== X-Received: by 2002:a05:6a21:a247:b0:1e1:afa9:d39b with SMTP id adf61e73a8af0-1e1dfc12584mr8746124637.7.1734167026495; Sat, 14 Dec 2024 01:03:46 -0800 (PST) Received: from C02DW0BEMD6R.bytedance.net ([2409:8a28:f4f:a9a4:5d46:4ef0:daa9:1db8]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-801d5a90ba0sm905731a12.16.2024.12.14.01.03.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Dec 2024 01:03:46 -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 Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Qi Zheng Subject: [PATCH 01/12] Revert "mm: pgtable: make ptlock be freed by RCU" Date: Sat, 14 Dec 2024 17:02:47 +0800 Message-Id: <1fdb3ee32e6958ad82229941b2213ef76b7c4705.1734164094.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: rspam04 X-Rspamd-Queue-Id: C83421A0003 X-Stat-Signature: td6fgbt33priaah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Jcx41JGgzi+iPdlalLrWwkzulL2lt8VERifanzLUdYATbcuAciFhSEopOIRTNADWOrx3nRbBLQWyfvMdcrA4G7deOGmpE+YurP1RNz95uHiBX5tq9e+/LNDfes2XW9NOedUkzmY8HxGyCEX7hcDsbOwSCfIqkNmAWQ+MNoN3870gTaETnXN9buGzkoSdzRtc3hS/HaxH+fC8mxWI1qkMcSCjXgQTpyTHDN9XZUMgd0W1fOqYiOQe/pxucxUKMl71JOk6LiWtv0SAaWeZ4l6hVIcn7fEfIm57VrQUNaeyDiMZuAh X-Bogosity: Ham, tests=bogofilter, spamicity=0.000156, 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 Acked-by: Yu Zhao --- 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 e7902980439cc..5e73e53c34e9e 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2988,7 +2988,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 df8f5152644ec..5d8779997266e 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. @@ -485,7 +478,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 d9af83dd86bbf..83765632e20b0 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -7041,34 +7041,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