From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail115-100.sinamail.sina.com.cn (mail115-100.sinamail.sina.com.cn [218.30.115.100]) (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 617DD206F17 for ; Wed, 5 Mar 2025 22:47:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=218.30.115.100 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741214834; cv=none; b=ogRLDs7xGyStfS4B0fxs0tf7Fqqdddkg79d2HhFrBw6VRVUgdJ1og7YethqVistSI6xc6cR3wVSysx7ULQ4iRxvdNHEjRVMP2p5E+Ory4CyIPmJJBcJcVgITratvbxfI1E4L3KcWgJcH2U3PIf3Sg77Z1+614gLZ9ETNQg4xyjQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741214834; c=relaxed/simple; bh=Giysu/tjLy7TiFQnaV1VHgDDO4OdNnanXoD5UIaaXJ4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HrdSDAeSfMetjk69eTafs6i6DbjSd5oD7QkC94mF5O+uGMXMjDD+8rfGhmnB/LGR5FrhleWObbtXfDl/jeKqwLjE4Ahq7hOBjgu4+/tg68r6ZXh9dLwumsMiyhE6FziO8Ak38JORk9qh+8Pnvy2c6GjQp33rMsZqGx49wat7dtY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com; spf=pass smtp.mailfrom=sina.com; arc=none smtp.client-ip=218.30.115.100 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sina.com X-SMAIL-HELO: localhost.localdomain Received: from unknown (HELO localhost.localdomain)([116.24.8.13]) by sina.com (10.185.250.23) with ESMTP id 67C8D4620000619E; Wed, 6 Mar 2025 06:47:00 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com Authentication-Results: sina.com; spf=none smtp.mailfrom=hdanton@sina.com; dkim=none header.i=none; dmarc=none action=none header.from=hdanton@sina.com X-SMAIL-MID: 6462088913194 X-SMAIL-UIID: 8718048AE1954DBFBAC9D1D84D431635-20250306-064700-1 From: Hillf Danton To: Oleg Nesterov Cc: K Prateek Nayak , Mateusz Guzik , "Sapkal, Swapnil" , Linus Torvalds , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] pipe_read: don't wake up the writer if the pipe is still full Date: Thu, 6 Mar 2025 06:46:45 +0800 Message-ID: <20250305224648.3058-1-hdanton@sina.com> In-Reply-To: <20250305114433.GA28112@redhat.com> References: <20250227211229.GD25639@redhat.com> <06ae9c0e-ba5c-4f25-a9b9-a34f3290f3fe@amd.com> <20250228143049.GA17761@redhat.com> <20250228163347.GB17761@redhat.com> <20250304050644.2983-1-hdanton@sina.com> <20250304102934.2999-1-hdanton@sina.com> <20250304233501.3019-1-hdanton@sina.com> <20250305045617.3038-1-hdanton@sina.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Wed, 5 Mar 2025 12:44:34 +0100 Oleg Nesterov > On 03/05, Hillf Danton wrote: > > See the loop in ___wait_event(), > > > > for (;;) { > > prepare_to_wait_event(); > > > > // flip > > if (condition) > > break; > > > > schedule(); > > } > > > > After wakeup, waiter will sleep again if condition flips false on the waker > > side before waiter checks condition, even if condition is atomic, no? > > Yes, but in this case pipe_full() == true is correct, this writer can > safely sleep. > No, because no reader is woken up before sleep to make pipe not full.