From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-178.mta1.migadu.com (out-178.mta1.migadu.com [95.215.58.178]) (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 642CE23EAAF for ; Tue, 2 Jun 2026 03:04:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780369459; cv=none; b=aMdSfaoEmxrBd/eywEx9rJGOrSSPV/klIkmULskf52T2vgGb4yibtZV4zU9qZdur78hZ/ii7kqrTkHKLhuBMT+KzxAgGX3j4hOWKx4Z9k9zeCQmWa6cad7E2/YHvYx9IJMKkZVSxgCe0dDHPemEQkNqeRVKXpV/+p6VeQ5DznPE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780369459; c=relaxed/simple; bh=OXmjOEi+lecQIjYsfXUEueTAjYo3WmlFZ2EHgoxFuzs=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=jjif7ytvY3jjPn+hHhhR2Xdm+qO9L3fsvxCFPkOIUS43f/YKopaYvZSj5DN6x0J28pZYPdeWVTHhY/2a3V5SM9RKldiQGy5dL5MYY6tmfCcTOG8nB0BfakjB6vvwOwoqiuoSSPAFKluN0MWeJReM0biDnmH2w8j6Vio6SJ2bcjo= 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=H6YRFQsh; arc=none smtp.client-ip=95.215.58.178 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="H6YRFQsh" Message-ID: <7e913ba8-fa91-4916-a871-66de7c80cd29@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1780369456; 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=sDava2KjOjyTlfhr7gzK0qHHVJTHw8GLUyRtPGdjosc=; b=H6YRFQshh9KQZATppc++ZGbsrjOG/f6ne+B8tS7X5VxX8ajjAWmDVAwwPHLY9ZwVVWOMAI 8+8vOPD+CKHAX5gKM2AmiB0DrSCkMffaGY+lCtOupp0DtCpl++22TMylOW8UbGlg1Mh1FS Rq6yLDXEsUSqeak5ThJvF8aE/YiZ0jY= Date: Tue, 2 Jun 2026 11:03:15 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH 1/2] mm/percpu: Preserve NOFS/NOIO scope during chunk create and populate To: Michal Hocko , Dennis Zhou Cc: Pedro Falcato , akpm@linux-foundation.org, tj@kernel.org, cl@gentwo.org, vbabka@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, muchun.song@linux.dev, Kaitao Cheng References: <20260528132917.81123-1-kaitao.cheng@linux.dev> <20260528132917.81123-2-kaitao.cheng@linux.dev> <5a4aa532-77a0-436a-8f5e-1bbcf2db6bbb@linux.dev> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kaitao Cheng In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT 在 2026/6/1 23:45, Michal Hocko 写道: > On Mon 01-06-26 10:27:53, Kaitao Cheng wrote: >> However, if we revert 9a5b183941b, it seems that all of these issues would >> be resolved. The only downside is that the failure rate of pcpu_alloc_noprof() >> allocations may increase, which might be acceptable. > > That has practical impact on some versions of iscsid which do not have > PR_SET_IO_FLUSHER. And maybe some more so I would rather not revert > based on a theoretical concerns which I believe is the case here. > Based on the previous discussion, I think we have a way to address most of the concurrency issues around percpu allocation. However, there still seems to be one remaining case that I do not yet have a good way to solve. For example: Thread A calls pcpu_alloc_noprof() with GFP_KERNEL and takes pcpu_alloc_mutex. Since the internal allocation is not constrained by NOFS, it may enter FS reclaim while still holding pcpu_alloc_mutex, creating a dependency like: pcpu_alloc_mutex -> fs_reclaim -> FS lock At the same time, Thread B may already hold an FS lock and then call pcpu_alloc_noprof() with GFP_NOFS. It will try to acquire pcpu_alloc_mutex and block, creating the reverse dependency: FS lock -> pcpu_alloc_mutex This can still form a potential deadlock cycle. Does anyone have a good suggestion for how to handle this remaining case? Or should we simply treat all GFP_KERNEL/GFP_NOFS allocation behavior in pcpu_alloc_noprof() as GFP_NOIO? If there is no clear solution for now, would it be acceptable to first fix some of the issues introduced by commit 9a5b183941b, and leave this remaining case as a pre-existing historical issue to be handled separately later? -- Thanks Kaitao Cheng