<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body>
Neil,<br>
<br>
Does your statement imply this would spin?&nbsp; It definitely doesnt just spin (that behavior in a main wait for work spot of a (depending on settings) ~per-CPU daemon would render systems unusable and this patch has been in testing for a while).&nbsp; So what is
 the detailed behavior of a timeout that expires immediately?<br>
<br>
- Patrick<br>
<br>
<br>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> lustre-devel &lt;lustre-devel-bounces@lists.lustre.org&gt; on behalf of NeilBrown &lt;neilb@suse.com&gt;<br>
<b>Sent:</b> Sunday, October 28, 2018 7:03:02 PM<br>
<b>To:</b> James Simmons; Andreas Dilger; Oleg Drokin<br>
<b>Cc:</b> Lustre Development List<br>
<b>Subject:</b> Re: [lustre-devel] [PATCH 12/28] lustre: ptlrpc: do not wakeup every second</font>
<div>&nbsp;</div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">On Sun, Oct 14 2018, James Simmons wrote:<br>
<br>
&gt; From: Alex Zhuravlev &lt;bzzz@whamcloud.com&gt;<br>
&gt;<br>
&gt; Even if there are no RPC requests on the set, there is no need to<br>
&gt; wake up every second. The thread is woken up when a request is added<br>
&gt; to the set or when the STOP bit is set, so it is sufficient to only<br>
&gt; wake up when there are requests on the set to worry about.<br>
&gt;<br>
&gt; Signed-off-by: Alex Zhuravlev &lt;bzzz@whamcloud.com&gt;<br>
&gt; WC-bug-id: <a href="https://jira.whamcloud.com/browse/LU-9660">https://jira.whamcloud.com/browse/LU-9660</a><br>
&gt; Reviewed-on: <a href="https://review.whamcloud.com/28776">https://review.whamcloud.com/28776</a><br>
&gt; Reviewed-by: Andreas Dilger &lt;adilger@whamcloud.com&gt;<br>
&gt; Reviewed-by: Patrick Farrell &lt;paf@cray.com&gt;<br>
&gt; Reviewed-by: Oleg Drokin &lt;green@whamcloud.com&gt;<br>
&gt; Signed-off-by: James Simmons &lt;jsimmons@infradead.org&gt;<br>
&gt; ---<br>
&gt;&nbsp; drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 4 &#43;&#43;--<br>
&gt;&nbsp; 1 file changed, 2 insertions(&#43;), 2 deletions(-)<br>
&gt;<br>
&gt; diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c<br>
&gt; index c201a88..5b4977b 100644<br>
&gt; --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c<br>
&gt; &#43;&#43;&#43; b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c<br>
&gt; @@ -371,7 &#43;371,7 @@ static int ptlrpcd_check(struct lu_env *env, struct ptlrpcd_ctl *pc)<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&gt;&nbsp; <br>
&gt; -&nbsp;&nbsp;&nbsp;&nbsp; return rc;<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; return rc || test_bit(LIOD_STOP, &amp;pc-&gt;pc_flags);<br>
&gt;&nbsp; }<br>
&gt;&nbsp; <br>
&gt;&nbsp; /**<br>
&gt; @@ -441,7 &#43;441,7 @@ static int ptlrpcd(void *arg)<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lu_context_enter(env.le_ses);<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (wait_event_idle_timeout(set-&gt;set_waitq,<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ptlrpcd_check(&amp;env, pc),<br>
&gt; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (timeout ? timeout : 1) * HZ) == 0)<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; timeout * HZ) == 0)<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ptlrpc_expired_set(set);<br>
<br>
This is incorrect.<br>
A timeout of zero means the timeout happens after zero jiffies<br>
(immediately), it doesn't mean there is no timeout.<br>
If we want a &quot;timeout&quot; of zero to mean &quot;Wait forever&quot;, we need something<br>
like:<br>
<br>
&nbsp; wait_event_idle_timeout(.....,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; timeout ? (timeout * HZ) : MAX_SCHEDULE_TIMEOUT) == 0<br>
<br>
I've updated the patch accordingly.<br>
<br>
Thanks,<br>
NeilBrown<br>
<br>
&gt;&nbsp; <br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lu_context_exit(&amp;env.le_ctx);<br>
&gt; -- <br>
&gt; 1.8.3.1<br>
</div>
</span></font></div>
</body>
</html>