From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1FFFD36DA13 for ; Sat, 11 Jul 2026 10:32:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783765966; cv=none; b=ng36taSWaVFMUi4VOS14xUtvCz4InTkZKVZRe0jogq2aIzZiNFvC8B6cCFqHyA5dSRxaZerOsQI4l8YC+rXpXDPtJjqzxWU1RrqbiqE0KM+6cWVYL4e7rVLM4HWdpS27eOqz8YKypnW8z6Nfa/IOCGke3Bi00Pn8eJhYyRKJC54= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783765966; c=relaxed/simple; bh=ujXvH+QUggs2BjDxPVxIjBSKMpGsHF/e6uAyGUcwkjI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=uh3uU1zObstRivWEH+HnHiW1P7OOEXA/Oy60uyGjrUgPW71/CxObQltgkn9RI/fn/QCdCGYmUzdvs2Dl3fXMRbhSkimnFz34aWIBfOEGVxmrZj3Q7NlG17mfCZuSFtBN8A77cGi52BV4DsNtMfVVwAd4FAlAUTLsHNTqkf2gs4g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=L29GElRT; arc=none smtp.client-ip=209.85.128.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="L29GElRT" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-493caa3c54eso15150685e9.2 for ; Sat, 11 Jul 2026 03:32:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1783765961; x=1784370761; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=JoGEUVDo62zcdMtD5EgM++hSQT8LOC5CKG+rJ8zo+lU=; b=L29GElRT+7+Bqmwtw0WRbtKhpaN+8z/6Vg+sfT/jO4pGoQ1wNEtYOXe7oq4mKc+n3c xFvXbIj7RLYZCfIK2ZD10YLgobp4fHDGhJQCMerqqGBUTp4gg9pMc8uI1JrgZj+esA22 uaRJUIdyEnOFCsGLKZIMznQ9enbZGgtL9r9EC1sE96JGHQuuYextMMXsOV5oZIAG6EBF rljA7VBTGqHDCLXQoX5Gm8+J2NhzfGhHZmi/021hLo2uv2K60LcieWDXnS7vqgXTDJvb mrr0q7h/rGKzn94Hxgetmf/geP43+assra5mqp7OsqPkYNJ4nnXtyuhviMVlqym+yb1m hqwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783765961; x=1784370761; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=JoGEUVDo62zcdMtD5EgM++hSQT8LOC5CKG+rJ8zo+lU=; b=WTC4DVW4qfyl2LZ/QtGk1KUQPBCF0iPlp9N6DFRrh5vC4MQDHES48EcBSOk5TX8pQa dz9f/kkKnMdhiYd14omoK26r5aJ0lGlRU4idLpzW9A1PYrpjKBv+8hKZyCq6Ymx6OieI 0t7YXFwuOEdkCHtjTfajuKWq0nHjw0lPVkZ7aBCbP6nwtzqhREpRxglGeupKvg3URoC2 qwVznm59HK3YZtjiFzZnaj6nHhTXQVeWNVr/BNUJqV1oLsYeq38E2+pEnngwnsdQxZ9b KrMzJx9ivxvJLLuPc/SwCN22DGqVNr1TQEIOKENpPVHfJFCspCzumPW0a1QyTXENXlKU S8qA== X-Forwarded-Encrypted: i=1; AHgh+RoPgml9lK7rSbfqrXNjlKiXgV6oQmd+69bIbRDysWgjBVPJvukeQQC4dZPoqbyZnsPB3vm5EY5FjDIe+So=@vger.kernel.org X-Gm-Message-State: AOJu0YwT93lMLHMNE5ibTC3AY5JfrIw1ZPgNn20Df5KUMqIdf5XbVJYw SYIk8ZqrM22EDOGBHAS5fTaLY8gQRKsBZx110VvJX6+SKialAGBrCiojsn4kk1ArA/PagWsv8Re nb0X48GA5acz7Dw1iwQ== X-Received: from wmht21.prod.google.com ([2002:a05:600c:41d5:b0:493:aecc:773c]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:4f8a:b0:492:43d2:9e6e with SMTP id 5b1f17b1804b1-493f87e9bd4mr20378535e9.9.1783765961023; Sat, 11 Jul 2026 03:32:41 -0700 (PDT) Date: Sat, 11 Jul 2026 10:32:39 +0000 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260707-upgrade-poll-v6-0-4b8fae7bf1d9@google.com> <20260707-upgrade-poll-v6-2-4b8fae7bf1d9@google.com> Message-ID: Subject: Re: [PATCH v6 2/2] rust_binder: move (e)poll wait queue to Process From: Alice Ryhl To: Boqun Feng Cc: Greg Kroah-Hartman , Carlos Llamas , Christian Brauner , "Paul E. McKenney" , Alexander Viro , Jan Kara , Miguel Ojeda , "=?utf-8?B?QmrDtnJu?= Roy Baron" , Benno Lossin , Andreas Hindborg , Trevor Gross , Danilo Krummrich , Gary Guo , linux-fsdevel@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" On Fri, Jul 10, 2026 at 05:30:30PM -0700, Boqun Feng wrote: > On Tue, Jul 07, 2026 at 10:43:13AM +0000, Alice Ryhl wrote: > > + { > > + let poll = loop { > > + if let Some(poll) = this.poll.as_ref() { > > + break poll; > > + } > > + > > + let poll = PollCondVarBox::new(c"Process::poll", kernel::static_lock_class!())?; > > + // Reuse our existing lock to synchronize callers initializing. > > + let _guard = this.node_refs.lock(); > > + this.poll.populate(poll); > > + }; > > Note sure whether this lock is needed? SetOnce::populate() should be > atomic, i.e. only one populate() would win? > > Also seems we should have a SetOnce::as_ref_or_populate(&self, default: > T). I'm taking this lock because I want to ensure that losers only loop once. The problem is that just because you lost the race in populate(), it's not guaranteed that as_ref() will return Some on the next iteration, since the winner of the race may still be busy executing populate(). Taking the loop avoids this possibility. With regards to as_ref_or_populate(), I point you to this discussion for reasons why this is hard: https://lore.kernel.org/all/aZLZbN5C3wXgt3kL@google.com/ > The rest looks good to me. FWIW, > > Reviewed-by: Boqun Feng Thanks! Alice