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 5EC8BECAAD3 for ; Mon, 19 Sep 2022 17:30:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CEE0D6B0072; Mon, 19 Sep 2022 13:30:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CD1096B0073; Mon, 19 Sep 2022 13:30:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B2092940007; Mon, 19 Sep 2022 13:30:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id A0DC36B0071 for ; Mon, 19 Sep 2022 13:30:43 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 7E4D1160947 for ; Mon, 19 Sep 2022 17:30:43 +0000 (UTC) X-FDA: 79929524766.10.69F6F2E Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf03.hostedemail.com (Postfix) with ESMTP id 1E3DD200A6 for ; Mon, 19 Sep 2022 17:30:42 +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-out2.suse.de (Postfix) with ESMTPS id 66DE41F898; Mon, 19 Sep 2022 17:30:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1663608641; 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=8PmLUJNFKcsCZ1gHK73spc+qwFN9fPuW7xXhdt6tJOQ=; b=e6Szmj3CuBWAGaE1OSi+u0rV50q+8/frIWnnJUsYfoI1YkRtwynZQIAPAzZBF53kC2c8qo TpH0+5DBMWTbq3nY1oQcn1dfOjAbNcbvndni9kqLeyui4IL00GcQklp1/PPVni591qnsTy uXPIrSLJEMCkCsbXBcDpTrO7E21Wusw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1663608641; 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=8PmLUJNFKcsCZ1gHK73spc+qwFN9fPuW7xXhdt6tJOQ=; b=li0L7ViU5O9rsAijUUzrIUd5EflTAR6rcTgXDPm55/qdpOSKXkT5g9waF+JS4WJ2VPMT5r IhkRpOff4kOgSoBw== 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 3D45413A96; Mon, 19 Sep 2022 17:30:41 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id XEZHDkGnKGPyKgAAMHmgww (envelope-from ); Mon, 19 Sep 2022 17:30:41 +0000 Message-ID: <045d6ddc-463c-a620-89e1-d48c86217c23@suse.cz> Date: Mon, 19 Sep 2022 19:30:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH V3] mm: slub: fix flush_cpu_slab()/__free_slab() invocations in task context. Content-Language: en-US To: Maurizio Lombardi Cc: linux-mm@kvack.org, rientjes@google.com, penberg@kernel.org, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, bigeasy@linutronix.de, Hyeonggon Yoo <42.hyeyoo@gmail.com>, Roman Gushchin References: <20220919163929.351068-1-mlombard@redhat.com> From: Vlastimil Babka In-Reply-To: <20220919163929.351068-1-mlombard@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=e6Szmj3C; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=li0L7ViU; spf=pass (imf03.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663608643; a=rsa-sha256; cv=none; b=SD5QY5NB9wVrPQfZtvt5r0mFMRa9Z/KwZf4SF6hjeaUQemNhRMTA1PMSv+Cp+UNQ1mE7iY iOkDyyMqXEiC1cMfCJDWg+FoTQKt6LpcGNeU3ny0blS8bkwql31yNMAsl0VdG0xOUvsIzi aYS32RiyMNPYBhx6SXEfAup75Hhi1hU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663608643; 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=8PmLUJNFKcsCZ1gHK73spc+qwFN9fPuW7xXhdt6tJOQ=; b=qMAYmenr58tHAiuPR8yJiyCx3djszGjNFCob5dMgaIP8Vkb0y1rzq0cKTdRu0VWPCH0zQr IhThy3WeUIaqpQDa/5dtgTMsJUkcEKLWIdaI7O/j5ZgA+VR4KtPRVq9ouHy0mXVqeoSsZV 6vdbw980+g6MvpWcUcrlp1I6Lnt+358= X-Rspam-User: X-Rspamd-Queue-Id: 1E3DD200A6 Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=e6Szmj3C; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=li0L7ViU; spf=pass (imf03.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none X-Stat-Signature: 3ryqxfcrtauq7kcjnr86b8woau5fw5z1 X-Rspamd-Server: rspam04 X-HE-Tag: 1663608642-226596 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 9/19/22 18:39, Maurizio Lombardi wrote: > Commit 5a836bf6b09f ("mm: slub: move flush_cpu_slab() invocations > __free_slab() invocations out of IRQ context") moved all flush_cpu_slab() > invocations to the global workqueue to avoid a problem related > with deactivate_slab()/__free_slab() being called from an IRQ context > on PREEMPT_RT kernels. > > When the flush_all_cpu_locked() function is called from a task context > it may happen that a workqueue with WQ_MEM_RECLAIM bit set ends up > flushing the global workqueue, this will cause a dependency issue. > > workqueue: WQ_MEM_RECLAIM nvme-delete-wq:nvme_delete_ctrl_work [nvme_core] > is flushing !WQ_MEM_RECLAIM events:flush_cpu_slab > WARNING: CPU: 37 PID: 410 at kernel/workqueue.c:2637 > check_flush_dependency+0x10a/0x120 > Workqueue: nvme-delete-wq nvme_delete_ctrl_work [nvme_core] > RIP: 0010:check_flush_dependency+0x10a/0x120[ 453.262125] Call Trace: > __flush_work.isra.0+0xbf/0x220 > ? __queue_work+0x1dc/0x420 > flush_all_cpus_locked+0xfb/0x120 > __kmem_cache_shutdown+0x2b/0x320 > kmem_cache_destroy+0x49/0x100 > bioset_exit+0x143/0x190 > blk_release_queue+0xb9/0x100 > kobject_cleanup+0x37/0x130 > nvme_fc_ctrl_free+0xc6/0x150 [nvme_fc] > nvme_free_ctrl+0x1ac/0x2b0 [nvme_core] > > Fix this bug by creating a workqueue for the flush operation with > the WQ_MEM_RECLAIM bit set. > > v2: Create a workqueue with WQ_MEM_RECLAIM > instead of trying to revert the changes. > > v3: replace create_workqueue() with alloc_workqueue() and BUG_ON() with > WARN_ON() > > Signed-off-by: Maurizio Lombardi Thanks, I added a Fixes: and Cc stable as AFAICS the warnings are not under a debugging config option, and it could bite somebody near OOM. Added to slab.git for-6.0/fixes and will include in pullrq this week.