From patchwork Tue Mar 22 17:39:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 12788856 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 A0BA4C433FE for ; Tue, 22 Mar 2022 17:39:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 02FA56B0071; Tue, 22 Mar 2022 13:39:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F207A6B0072; Tue, 22 Mar 2022 13:39:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E0F0C6B0074; Tue, 22 Mar 2022 13:39:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id D1A3E6B0071 for ; Tue, 22 Mar 2022 13:39:47 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id A09EC81432 for ; Tue, 22 Mar 2022 17:39:47 +0000 (UTC) X-FDA: 79272734814.13.DB0D478 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf08.hostedemail.com (Postfix) with ESMTP id 23E9316001D for ; Tue, 22 Mar 2022 17:39:46 +0000 (UTC) Date: Tue, 22 Mar 2022 18:39:44 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1647970785; h=from:from: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; bh=A7BW5160vuR7/lsEbu+kbp1W/aUpcUZQTxtTq7olql4=; b=cKkSpSTkFQjPyRtd25ydXRugSvu4NVGv51dqjSTJCMdD9r52dqs+QiqcX2JaWPjfLnn15R jxdfwPHxqZcCNQsujx8IhP1deeG3Zelp6GKaaDpZu99UHpUNK/5wcOzOCpzIvaKZN+xc9g KWacI6fNLXq7GTJ0Y9NNcy3IB5f+ccoKl8+vTqLgCFIrv7J5j/yUk7W3dWVS8tpYF+oxDG Aop3pmUb5uvl/Vg+OWykm4QJm613/NIpgDKdnDyAo3HnFoLWTtnWOMqBGGHmNzfL0/wBxu +W7GzQrnFxUzKSRFjiA7XAWfo6DCob7gO1XC1MvfE0qEvixqpbfORIGlPQ+CDw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1647970785; h=from:from: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; bh=A7BW5160vuR7/lsEbu+kbp1W/aUpcUZQTxtTq7olql4=; b=QpA0YXZBqTfd8esVIsajSnCdY1WwnVfk9GFQ7OhYJuuMklAm9akVcu8gMhvPITh6rvqgZR kcvZWq/3G6LahpAw== From: Sebastian Andrzej Siewior To: linux-mm@kvack.org Cc: Vlastimil Babka , Michal Hocko , Thomas Gleixner Subject: slab_pre_alloc_hook() strips __GFP_NOLOCKDEP away. Message-ID: MIME-Version: 1.0 Content-Disposition: inline Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=cKkSpSTk; dkim=pass header.d=linutronix.de header.s=2020e header.b=QpA0YXZB; spf=pass (imf08.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 23E9316001D X-Stat-Signature: 8gu6t49i5cxwu9oz7i5fw44qwrfzd4xn X-HE-Tag: 1647970786-418048 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Run into | ====================================================== | WARNING: possible circular locking dependency detected | 5.17.0-next-20220322 #19 Not tainted | ------------------------------------------------------ | kswapd1/513 is trying to acquire lock: | ffff888555b7e628 (&xfs_dir_ilock_class){++++}-{3:3}, at: xfs_icwalk_ag+0x36c/0x810 | | but task is already holding lock: | ffffffff82a2fb20 (fs_reclaim){+.+.}-{0:0}, at: balance_pgdat+0x600/0x740 | | which lock already depends on the new lock. | | | the existing dependency chain (in reverse order) is: | | -> #1 (fs_reclaim){+.+.}-{0:0}: | fs_reclaim_acquire+0xaa/0xe0 | __kmalloc_node+0x65/0x3e0 | xfs_attr_copy_value+0x70/0xa0 … and I think this is similar to commit 704687deaae76 ("mm: make slab and vmalloc allocators __GFP_NOLOCKDEP aware") and maybe something like this: ? Sebastian diff --git a/mm/slab.h b/mm/slab.h --- a/mm/slab.h +++ b/mm/slab.h @@ -717,7 +717,7 @@ static inline struct kmem_cache *slab_pre_alloc_hook(struct kmem_cache *s, struct obj_cgroup **objcgp, size_t size, gfp_t flags) { - flags &= gfp_allowed_mask; + flags &= gfp_allowed_mask | __GFP_NOLOCKDEP; might_alloc(flags);