From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oleg Nesterov Subject: Re: linux-next: Tree for Jun 28 [ BISECTED: rsyslog/imklog: High CPU usage ] Date: Sun, 30 Jun 2013 20:19:45 +0200 Message-ID: <20130630181945.GA5171@redhat.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mx1.redhat.com ([209.132.183.28]:26911 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751969Ab3F3Sai (ORCPT ); Sun, 30 Jun 2013 14:30:38 -0400 Content-Disposition: inline In-Reply-To: Sender: linux-next-owner@vger.kernel.org List-ID: To: Sedat Dilek Cc: linux-next@vger.kernel.org, linux-kernel@vger.kernel.org, Stephen Rothwell , Andrew Morton , Tejun Heo , Daniel Vetter , Imre Deak , Lukas Czerner , Samuel Ortiz , Wensong Zhang , Simon Horman , Julian Anastasov , Ralf Baechle , Valdis.Kletnieks@vt.edu Andrew, please drop these wait-introduce-wait_event_commonwq-condition-state-timeout.patch wait-introduce-prepare_to_wait_event.patch patches again. I'll send v3 although it really looks like I should never try to touch wait.h. On 06/29, Sedat Dilek wrote: > > As this all did not show me what caused the problem I started a > git-bisect session. > > This revealed the following culprit commit: > > commit bb1f30cb7d3ba21098f0ee7e0382160ba2599a43 > "wait: introduce wait_event_common(wq, condition, state, timeout)" Heh. First of all, I am really sorry. Not only "__wait_no_timeout(tout) ?:" was wrong, I didn't bother to recheck this logic even after I got the "warning: the omitted middle operand in ?:" reports. Sedat, thanks you very much! Any chance you can try the patch below? Oleg. --- a/include/linux/wait.h +++ b/include/linux/wait.h @@ -191,12 +191,8 @@ wait_queue_head_t *bit_waitqueue(void *, int); for (;;) { \ __ret = prepare_to_wait_event(&wq, &__wait, state); \ if (condition) { \ - __ret = __wait_no_timeout(tout); \ - if (!__ret) { \ - __ret = __tout; \ - if (!__ret) \ - __ret = 1; \ - } \ + __ret = __wait_no_timeout(tout) ? 0 : \ + (__tout ?: 1); \ break; \ } \ \ @@ -217,16 +213,10 @@ wait_queue_head_t *bit_waitqueue(void *, int); #define wait_event_common(wq, condition, state, tout) \ ({ \ long __ret; \ - if (condition) { \ - __ret = __wait_no_timeout(tout); \ - if (!__ret) { \ - __ret = tout; \ - if (!__ret) \ - __ret = 1; \ - } \ - } else { \ + if (condition) \ + __ret = __wait_no_timeout(tout) ? 0 : ((tout) ?: 1); \ + else \ __ret = __wait_event_common(wq, condition, state, tout);\ - } \ __ret; \ })