From mboxrd@z Thu Jan 1 00:00:00 1970 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 5AFFFC19F2D for ; Thu, 11 Aug 2022 08:43:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 01D126B0073; Thu, 11 Aug 2022 04:43:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F0F368E0002; Thu, 11 Aug 2022 04:43:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D88A78E0001; Thu, 11 Aug 2022 04:43:00 -0400 (EDT) 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 C90276B0073 for ; Thu, 11 Aug 2022 04:43:00 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 1172BA24A4 for ; Thu, 11 Aug 2022 08:43:00 +0000 (UTC) X-FDA: 79786671720.01.ACA1DA9 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf12.hostedemail.com (Postfix) with ESMTP id 2493C40190 for ; Thu, 11 Aug 2022 08:42:59 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id EA4D43887D; Thu, 11 Aug 2022 08:42:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1660207377; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZkboUzJy3Zp63RwUT0MvCC9BXkr98noX/o2s5nZgrak=; b=jXFZemrDhfuQq7wzEZMYPub+Hd/3el/KRjfv75viUMnyB2HEYcZndpeGKHH//MCjaOoJTd c+BlYdG/y6ptDoDnxXvV1XdtJMp645pXW8MrUDOrnNpIb2f0Rp0qySvUHwLQF60A/hrFd/ Rh56wvBwRs0hAQQQCNJiSambpckq09w= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1660207377; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZkboUzJy3Zp63RwUT0MvCC9BXkr98noX/o2s5nZgrak=; b=SZx+4xC+kuu5xBgzbkOHoHnuwPiYIBwS7li1oOWtuhkoRmNQnz+wzvOvJ+/vRY8Fwug4NM AIiLnmI8INPHQeDA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id C5ACA13A9B; Thu, 11 Aug 2022 08:42:57 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id mK6aLxHB9GKdWQAAMHmgww (envelope-from ); Thu, 11 Aug 2022 08:42:57 +0000 Message-ID: <849041c0-b5b8-5240-2526-bd88782c87ae@suse.cz> Date: Thu, 11 Aug 2022 10:42:57 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.1.0 From: Vlastimil Babka Subject: Re: [PATCH] mm, slub: restrict sysfs validation to debug caches and make it safe To: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Rongwei Wang , Christoph Lameter , Joonsoo Kim , David Rientjes , Pekka Enberg , Roman Gushchin , linux-mm@kvack.org, Feng Tang References: <20220809140043.9903-1-vbabka@suse.cz> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660207379; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ZkboUzJy3Zp63RwUT0MvCC9BXkr98noX/o2s5nZgrak=; b=I1JlloGVSqoYL605SSHFISvAdHa6SGSVFXv1e+rollmgIPUoq36ExjqvYSTeumL8F00Gvq LYFO5hQroV1M5CZfda00IHU/QEeSzQrvAMrutsknkFEkSjhKSuIWUrXmZg1hXa1t9bQULs fCXtgOMzuwXHs4yHXXWe7RFoouU6e3s= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=jXFZemrD; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=SZx+4xC+; spf=pass (imf12.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660207379; a=rsa-sha256; cv=none; b=KptKekRkImIrTMTlpwmGNf2N6X6DGd+iD4aan+TWZQ0m8c0Wfssj7zqprhsSbZKcVkSwRE 2snjsjyWWYt+lgpslOR0oyxbaFtBmX6lLGsu73aoWm6WvjQtaLVN4s67BxQzTzj1SBRjiL q3heRWyCJbwUl3/jW7sXYhCU6k9EltE= X-Stat-Signature: hhfopjbo88ehdd9yrkfbbo781ogxf3s4 X-Rspamd-Queue-Id: 2493C40190 Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=jXFZemrD; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=SZx+4xC+; spf=pass (imf12.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none X-Rspam-User: X-Rspamd-Server: rspam06 X-HE-Tag: 1660207379-227915 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: On 8/11/22 08:53, Hyeonggon Yoo wrote: > > I started to wonder... > > Do we need slab_lock() after this patch for debugging caches? > > if SLUB never takes a slab from partial list (unless moving to another list or freeing it), > and if you must acquire list_lock before accessing (to alloc/free objects) per-node partial list, > Why do we need it? Yeah, looks like we shouldn't need it anymore as n->list_lock will cover everything now. Great observation! > Of course, it is still needed for ARCHs that does not support > cmpxchg_double(). > > But as code for debugging caches is separated after this patch, > maybe we can simply drop slab_lock() in: > - alloc_debug_processing() > - free_debug_processing() > - alloc_single_from_{new_slab,partial}() > - validate_slab() list_slab_objects() too, with some care for the locking in get_map(). > And also relevant comments. As it's becoming too large, I will split this to more patches. Thanks!