Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2625297rbb; Wed, 28 Feb 2024 07:38:35 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUQ12+BQmlivJOStjSrCz745jcJK/a4OdTDSGftb8SMHrjuJR6cLeS+SpWqnnhBXNBtc/pSaef32APWTHUfbYaJ3SC55/NniGGtOe0epw== X-Google-Smtp-Source: AGHT+IElYsdXLrLeJvKhoC0F7n8AJmaGBQ3E/vUpoS6gpBA2C5rmUTQAGi/qyzlB9H1JVHnUSYqY X-Received: by 2002:a05:6a20:6f0a:b0:1a1:e75:477c with SMTP id gt10-20020a056a206f0a00b001a10e75477cmr6444171pzb.9.1709134714838; Wed, 28 Feb 2024 07:38:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709134714; cv=pass; d=google.com; s=arc-20160816; b=wS6mY0dGgra4q8IYuC+KrMCkJk1T+pWzqaTxAeprqqBkFKz3BSj3XgcOLfoNJu0Cf3 N/NfEZz3v7fDnDXei33bnGX3A9zrohtEdbldle/1qDnSj7WuadNepCJaNbU+zLbROk4t nMGyZ5gKIswVBx7IBj4SHxYiXor3oMcxd+KBUgN5zIBRmkqGgUEVHOG9/sAUPgn8axcV cYyMEqnXn6nIBkn8EdAWWceuXl/j6phpJbGpc+dxlwXN7nnZ/nEoqiT44ISz1hYdGckQ B2tR48bMMjSHZAM5SD9jEU2Nb4x2D059APlX8JpHmC/wu7tF3+a1/BWI5P4ogZK339HQ 0how== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature:message-id; bh=oAMr9s0PDAu7F214uDGmplVN6l5UXk4Dj4yqN4bYWl8=; fh=y+woRx86y3IPquQqVGBuWniJ+FX0P51QJw9pHltrU8o=; b=EGgWB1ZqrZk0JSJfrFa/WTRO8hEXjTIRR8bIfNYCMeEc7cBc+U9OXbSnTFZhOwqMs3 0bRuEtFe8IpSjtl1kbRRl+FPrJcP46bcWWTQU/ZJdSN5Zvk9iBCSlqP6mG1gRK8TihZ8 /PI8RuQKpccsdUx1NiJ6VzlH3YgczVHQrUW+oiGXF7KkPFaHroyWGkpwdn3g5HjuvcxA NdyfsLl2W6V36+PS1e1RWS3+aqGhVuZko155Qn2LEwQB3ngkPDfnzLy6LbSY8XlMiPdV +FCwydO5+2/jhk9ZxSvRG2eLNOFVk6CcY3THZhLworYVRD1aH7jvVrO7WSDtirbaUfqC xkiA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=dRf76Gze; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-85274-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85274-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id jo12-20020a056a00908c00b006e558b4e179si2020437pfb.235.2024.02.28.07.38.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 07:38:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85274-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=dRf76Gze; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-85274-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85274-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 8B2F02857C6 for ; Wed, 28 Feb 2024 15:38:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 67A6615CD65; Wed, 28 Feb 2024 15:38:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="dRf76Gze" Received: from out-185.mta1.migadu.com (out-185.mta1.migadu.com [95.215.58.185]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0BB2D1487DC for ; Wed, 28 Feb 2024 15:38:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.185 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709134697; cv=none; b=WYPZrX0LMiQaPavehQX5RCF7NUAb3r6w/NYDJmdqKFPQb5qA8UId523Xikqy/bU074XO7HlZ3T+0c2XTNDKgMwJNPlgrOTdReDmExUgD60HdKIwOm8JeGqoeaJijkv3/1vbyhwkj/+8LlT4mPHmSFZnYAocWL/90LC09q3uBY4c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709134697; c=relaxed/simple; bh=NbS4ybyMq5F+EbD4iOULthp4VmxMo+5F4uVrDuOU59s=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=I5YB4COuTMsRg5RGdZpXWQRt/x3kgOmyeyWn9LBHPqLe+zNL1RTynIhij88PvBiKIDbt5Dqs+iin5295rE/QlshrciTGvWmBh58a7TOuaXpTHGAsCqd3HFBjUYV1XwZbEbcF5qCb/SFtj/DwjcqLy9YPL3xdJnospKrmMvX9jI4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=dRf76Gze; arc=none smtp.client-ip=95.215.58.185 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Message-ID: <1d920f2c-2f86-46b9-b5d9-b5615284e5c3@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1709134692; 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: in-reply-to:in-reply-to:references:references; bh=oAMr9s0PDAu7F214uDGmplVN6l5UXk4Dj4yqN4bYWl8=; b=dRf76GzeokEhPZ1ik9l9Sy4CMEvb8socWoqzXfb4JNB/MOwXUk9MD6NNgtm0DybRYSCukn J0+8Uacsdj14kAdx2yBFH/2ipO36LZt1i4rvlDGaUCRfs1t7xzLPp6WwtFKMF/O0huYkl4 VLvYG4kmbkAbUCoImGTL7500ghvShZk= Date: Wed, 28 Feb 2024 23:37:44 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH mm-unstable hotfix] mm/zswap: fix zswap_pools_lock usages after changing to percpu_ref Content-Language: en-US To: Matthew Wilcox Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, yosryahmed@google.com, nphamcs@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20240210-zswap-global-lru-v3-2-200495333595@bytedance.com> <20240228151832.2431993-1-chengming.zhou@linux.dev> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Chengming Zhou In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 2024/2/28 23:24, Matthew Wilcox wrote: > On Wed, Feb 28, 2024 at 03:18:32PM +0000, Chengming Zhou wrote: >> Now the release of zswap pool is controlled by percpu_ref, its release >> callback (__zswap_pool_empty()) will be called when percpu_ref hit 0. >> But this release callback may potentially be called from RCU callback >> context by percpu_ref_kill(), which maybe in the interrupt context. >> >> So we need to use spin_lock_irqsave() and spin_unlock_irqrestore() >> in the release callback: __zswap_pool_empty(). In other task context >> places, spin_lock_irq() and spin_unlock_irq() are enough to avoid >> potential deadlock. > > RCU callback context is BH, not IRQ, so it's enough to use > spin_lock_bh(), no? You're right, it's the softirq context, so spin_lock_bh() is enough. Thanks!