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 X-Spam-Level: X-Spam-Status: No, score=-15.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F6ADC47094 for ; Mon, 7 Jun 2021 12:32:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 95F1E610E7 for ; Mon, 7 Jun 2021 12:32:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 95F1E610E7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 169F76B006C; Mon, 7 Jun 2021 08:32:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 11A896B006E; Mon, 7 Jun 2021 08:32:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ED63F6B0070; Mon, 7 Jun 2021 08:32:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0201.hostedemail.com [216.40.44.201]) by kanga.kvack.org (Postfix) with ESMTP id B85C46B006C for ; Mon, 7 Jun 2021 08:32:50 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 4B97C5DF9 for ; Mon, 7 Jun 2021 12:32:50 +0000 (UTC) X-FDA: 78226866900.28.7203932 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf14.hostedemail.com (Postfix) with ESMTP id 524AAC00CBE9 for ; Mon, 7 Jun 2021 12:32:47 +0000 (UTC) Received: from imap.suse.de (imap-alt.suse-dmz.suse.de [192.168.254.47]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 9E9B121A96; Mon, 7 Jun 2021 12:32:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623069168; 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=bYe/q0XZrVntCLS9h05Nia2rO3f+wWzh6PGpj/Yy9h4=; b=vmT5v5q/BU0n/R6rlUEaXiMI6am6a1Gbh2ifEElQ1Zk4VYqib346fXY7X1D55/N/vTjNV5 +rhizXMk/rJ78j7EOyNcd75/Sx3lYuocO301AWY915eup811E9dlbxb7onyGXRU+MZMHK9 sfDxefgyDE9Ouri0c5rwtSVL0IzRQtM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623069168; 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=bYe/q0XZrVntCLS9h05Nia2rO3f+wWzh6PGpj/Yy9h4=; b=QSFj2kiJ7Dp/neGZN2xzbOkvYe6O7s2l7vzZICVAR8gf/8cX9RyNiaSF/jXqUfgW2ki1De gockk7eDEIrK2/CQ== Received: from imap3-int (imap-alt.suse-dmz.suse.de [192.168.254.47]) by imap.suse.de (Postfix) with ESMTP id 827B3118DD; Mon, 7 Jun 2021 12:32:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623069168; 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=bYe/q0XZrVntCLS9h05Nia2rO3f+wWzh6PGpj/Yy9h4=; b=vmT5v5q/BU0n/R6rlUEaXiMI6am6a1Gbh2ifEElQ1Zk4VYqib346fXY7X1D55/N/vTjNV5 +rhizXMk/rJ78j7EOyNcd75/Sx3lYuocO301AWY915eup811E9dlbxb7onyGXRU+MZMHK9 sfDxefgyDE9Ouri0c5rwtSVL0IzRQtM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623069168; 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=bYe/q0XZrVntCLS9h05Nia2rO3f+wWzh6PGpj/Yy9h4=; b=QSFj2kiJ7Dp/neGZN2xzbOkvYe6O7s2l7vzZICVAR8gf/8cX9RyNiaSF/jXqUfgW2ki1De gockk7eDEIrK2/CQ== Received: from director2.suse.de ([192.168.254.72]) by imap3-int with ESMTPSA id 6StMH/ARvmBNfgAALh3uQQ (envelope-from ); Mon, 07 Jun 2021 12:32:48 +0000 To: Muchun Song , cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20210606041750.69403-1-songmuchun@bytedance.com> From: Vlastimil Babka Subject: Re: [PATCH] mm: slub: replace local_irq_save with local_irq_disable Message-ID: <028651d9-5e3b-8348-00af-e6acf8ea4ced@suse.cz> Date: Mon, 7 Jun 2021 14:32:48 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: <20210606041750.69403-1-songmuchun@bytedance.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b="vmT5v5q/"; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=QSFj2kiJ; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b="vmT5v5q/"; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=QSFj2kiJ; dmarc=none; spf=pass (imf14.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz X-Stat-Signature: wikond4691ik6wkpihkbf8c663birn3e X-Rspamd-Queue-Id: 524AAC00CBE9 X-Rspamd-Server: rspam02 X-HE-Tag: 1623069167-207916 Content-Transfer-Encoding: quoted-printable 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 6/6/21 6:17 AM, Muchun Song wrote: > The caller of slub_cpu_dead cannot be irq disabled (because slab_mutex = is > holding during the processing), there is no need to use irq_save. Just = use > irq_disable directly. Well, we shouldn't need to disable irq at all. We are cleaning up for a d= ead cpu, so there's nobody else accesing the data. irq save/disable will prot= ect only the local cpu's data, not of the cpu we are flushing. But we can't s= imply remove the irq disable/enable because there are some nested VM_BUG_ON(!irqs_disabled()) under __flush_cpu_slab(). We basically only d= isable irqs here to avoid those from triggering. My series [1] addresses this completely (among other things), but it's ea= rly stage RFC (v2 should be soon). Your patch is not wrong, but also not urge= nt or perf critical. So with that context I'll leave the decision to others :) [1] https://lore.kernel.org/lkml/20210524233946.20352-1-vbabka@suse.cz/ > Signed-off-by: Muchun Song > --- > mm/slub.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) >=20 > diff --git a/mm/slub.c b/mm/slub.c > index ee51857d8e9b..fbf592ef14ff 100644 > --- a/mm/slub.c > +++ b/mm/slub.c > @@ -2529,13 +2529,12 @@ static void flush_all(struct kmem_cache *s) > static int slub_cpu_dead(unsigned int cpu) > { > struct kmem_cache *s; > - unsigned long flags; > =20 > mutex_lock(&slab_mutex); > list_for_each_entry(s, &slab_caches, list) { > - local_irq_save(flags); > + local_irq_disable(); > __flush_cpu_slab(s, cpu); > - local_irq_restore(flags); > + local_irq_enable(); > } > mutex_unlock(&slab_mutex); > return 0; >=20