From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: ACJfBov7GRmuDkr/IK90dt6p0VKfJC1ESCNllTb668oZ1c0OIluJdRv42+asCDuAWiRgx3Z11v3w ARC-Seal: i=1; a=rsa-sha256; t=1516203393; cv=none; d=google.com; s=arc-20160816; b=ULUhKOyXdlM67avxYDLRwZyinNb8k+/2tG2QSu+F5pVu8BAvygxHImEg1Y7Uuh+2Pd SU/DY7wnrlSFp4+zt5oRS6pCkEpcUCG7GWKQ/mMYPLY3RR46QCvXSe573b+QVDIhwE/c vs64FoJMcIRm48OfiNZXUY8F7ZtZOVoYNNuuqulp8rehoSG1pvVc3NxU3KHbROi4Jpu6 gNJfmDQRk0ZZL8Qyy1L36FWbE4u9A0TCAITIAQ3hQEcc41bXoutNMkBIV5j+RHsIHUpd AvLQDiQLiQ/A9QumMNksCurSLzoQNg4JJJNNLDV7b0O3P6TB4Y7A2BuJLU9wrSh/tRTQ J0CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:message-id:in-reply-to:subject :cc:to:from:date:dkim-signature:arc-authentication-results; bh=A+2Lk9XlAggcqLKA21yY6F/LsdPQP3C9LoIUnyu285I=; b=CSbdMlRkK5b/X4ILg47f1LDavCbzx7zbHsoxdhqTSmLdhtAqxB+WjTxVVD1LHRi7ls oINrF94ComLLuPZT75Yecm5Y9bEpoFt/nmad2Ll9/RiqiXTm4clN95Qebr3TjQfdccJW 7lfas00QEfvgcQ7pK4yQZfuD2l7lu6GLJGJ9mAQPJGq6cUVFW3uf5SJHnilbQpqLs5Ue LH3Fh0+w7c/ZVRR92nZ5vXxaBpKcybjrg4fRk94YbDQYGruEgTTvkXc82qH9FVFwwxhD E5jt3H0Nh+X4308zzmZ5wOjZMGzOP6X0pmw3+QDD2727eXB8T2LIdUnA/QtIQTWgSyW4 rOTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=aGR2oY8z; spf=pass (google.com: best guess record for domain of jsimmons@infradead.org designates 2001:8b0:10b:1236::1 as permitted sender) smtp.mailfrom=jsimmons@infradead.org Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=aGR2oY8z; spf=pass (google.com: best guess record for domain of jsimmons@infradead.org designates 2001:8b0:10b:1236::1 as permitted sender) smtp.mailfrom=jsimmons@infradead.org Date: Wed, 17 Jan 2018 15:36:28 +0000 (GMT) From: James Simmons To: NeilBrown cc: Oleg Drokin , Andreas Dilger , Greg Kroah-Hartman , lkml , lustre Subject: Re: [PATCH 18/19] staging: lustre: replace l_wait_event_exclusive_head() with wait_event_idle_exclusive In-Reply-To: <151538209398.23920.3167444012358212836.stgit@noble> Message-ID: References: <151538168618.23920.8261096424342988792.stgit@noble> <151538209398.23920.3167444012358212836.stgit@noble> User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180117_153628_916754_651294B6 X-CRM114-Status: GOOD ( 19.05 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on casper.infradead.org summary: Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 NO_RELAYS Informational: message was not relayed via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1588993493528054553?= X-GMAIL-MSGID: =?utf-8?q?1589854489880989358?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: > This l_wait_event_exclusive_head() will wait indefinitely > if the timeout is zero. If it does wait with a timeout > and times out, the timeout for next time is set to zero. > > The can be mapped to a call to either > wait_event_idle_exclusive() > or > wait_event_idle_exclusive_timeout() > depending in the timeout setting. > > The current code arrange for LIFO queuing of waiters, > but include/event.h doesn't support that yet. > Until it does, fall back on FIFO with > wait_event_idle_exclusive{,_timeout}(). Reviewed-by: James Simmons > Signed-off-by: NeilBrown > --- > drivers/staging/lustre/lustre/ptlrpc/service.c | 43 ++++++++++++++---------- > 1 file changed, 25 insertions(+), 18 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c > index 6e3403417434..29fdb54f16ca 100644 > --- a/drivers/staging/lustre/lustre/ptlrpc/service.c > +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c > @@ -1897,15 +1897,6 @@ ptlrpc_check_rqbd_pool(struct ptlrpc_service_part *svcpt) > } > } > > -static int > -ptlrpc_retry_rqbds(void *arg) > -{ > - struct ptlrpc_service_part *svcpt = arg; > - > - svcpt->scp_rqbd_timeout = 0; > - return -ETIMEDOUT; > -} > - > static inline int > ptlrpc_threads_enough(struct ptlrpc_service_part *svcpt) > { > @@ -1968,13 +1959,17 @@ ptlrpc_server_request_incoming(struct ptlrpc_service_part *svcpt) > return !list_empty(&svcpt->scp_req_incoming); > } > > +/* We perfer lifo queuing, but kernel doesn't provide that yet. */ > +#ifndef wait_event_idle_exclusive_lifo > +#define wait_event_idle_exclusive_lifo wait_event_idle_exclusive > +#define wait_event_idle_exclusive_lifo_timeout wait_event_idle_exclusive_timeout > +#endif > + > static __attribute__((__noinline__)) int > ptlrpc_wait_event(struct ptlrpc_service_part *svcpt, > struct ptlrpc_thread *thread) > { > /* Don't exit while there are replies to be handled */ > - struct l_wait_info lwi = LWI_TIMEOUT(svcpt->scp_rqbd_timeout, > - ptlrpc_retry_rqbds, svcpt); > > /* XXX: Add this back when libcfs watchdog is merged upstream > lc_watchdog_disable(thread->t_watchdog); > @@ -1982,13 +1977,25 @@ ptlrpc_wait_event(struct ptlrpc_service_part *svcpt, > > cond_resched(); > > - l_wait_event_exclusive_head(svcpt->scp_waitq, > - ptlrpc_thread_stopping(thread) || > - ptlrpc_server_request_incoming(svcpt) || > - ptlrpc_server_request_pending(svcpt, > - false) || > - ptlrpc_rqbd_pending(svcpt) || > - ptlrpc_at_check(svcpt), &lwi); > + if (svcpt->scp_rqbd_timeout == 0) > + wait_event_idle_exclusive_lifo( > + svcpt->scp_waitq, > + ptlrpc_thread_stopping(thread) || > + ptlrpc_server_request_incoming(svcpt) || > + ptlrpc_server_request_pending(svcpt, > + false) || > + ptlrpc_rqbd_pending(svcpt) || > + ptlrpc_at_check(svcpt)); > + else if (0 == wait_event_idle_exclusive_lifo_timeout( > + svcpt->scp_waitq, > + ptlrpc_thread_stopping(thread) || > + ptlrpc_server_request_incoming(svcpt) || > + ptlrpc_server_request_pending(svcpt, > + false) || > + ptlrpc_rqbd_pending(svcpt) || > + ptlrpc_at_check(svcpt), > + svcpt->scp_rqbd_timeout)) > + svcpt->scp_rqbd_timeout = 0; > > if (ptlrpc_thread_stopping(thread)) > return -EINTR; > > >