Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp5257887ima; Tue, 5 Feb 2019 08:46:52 -0800 (PST) X-Google-Smtp-Source: AHgI3IZBkmdpEFZRM2WdiWjeGorvN+CTFlIpzDaNi0IS0n9Fomnv7nYAP5y1eWAAmsX6nOXL/Txw X-Received: by 2002:a17:902:7590:: with SMTP id j16mr5414692pll.231.1549385211976; Tue, 05 Feb 2019 08:46:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549385211; cv=none; d=google.com; s=arc-20160816; b=r07o/BChkxI5RjUUG2xR1rJ4PVcnWlVssJ2iopkbX2fymu98j3tbGvMmJU0z5dAX12 8lIdObYksN2CMyDmdsfeVmUf3mYERkVz+pyJzIknZyopJC3xytQ0Qa8OAg+IvzVJiJB3 o8fHz6lgDWFfYk1Vom79FOTOikwVXu91UCf4ZMSv52RnEYWqp+GETwp8/ElIP03cRRyE IrnDM00pSwJvIWtL3++F4xVvxfNY8RJhrPjB1P0Lif7n75wjrNaIUDBkCym9+hz0DCYn 8QJMzYo2xl+L07e3UZAnynmUbit/Ksl3KPqzaKsxBCkEO7X3o8A0i/+jopocgRWzUeLE iXAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=3MyYNZ94U9kqmUXktPbHyDE74mj5HBGwqxo8XES1UFM=; b=kGkSKOalj6aVJn57tH9FalTXWVazKfdtYRBymNwemcZcpLaMqiH04/AbVCkuLIUUZF SWlnXKc92hZ1WwNgHb+Z7mHX4EphXLk1R5Z1yBbFSFt9Q/zAA5DTleI5RRIPX0a8jAnk BWwrxtf1594s3ens98p+CYnIslRnFTYCoph9k0n408vdLAFR3JAHMGiBvKhnPOt2/var nnvb5jZNTJHJEXoP1cumcBFBmNHkKQU4DJa67fy0kgYigofGFqHTzxH5YIHIOIrAkNgh e480Cs0/63QP+DeiQWy+X+IIkFUNFSczGFXQfGbFNgjZp6xBUDz4y3nuKpoO/ELcxJn+ EG1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=xg+N7yjN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n3si3814911pfn.285.2019.02.05.08.46.35; Tue, 05 Feb 2019 08:46:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=xg+N7yjN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730136AbfBEQmR (ORCPT + 99 others); Tue, 5 Feb 2019 11:42:17 -0500 Received: from mail-qt1-f196.google.com ([209.85.160.196]:43468 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727884AbfBEQmQ (ORCPT ); Tue, 5 Feb 2019 11:42:16 -0500 Received: by mail-qt1-f196.google.com with SMTP id c6so2787238qtp.10 for ; Tue, 05 Feb 2019 08:42:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=3MyYNZ94U9kqmUXktPbHyDE74mj5HBGwqxo8XES1UFM=; b=xg+N7yjNoKJSNqVLa2/6pA6Csz5s2U78FTevPT3oa56BbbUfr0t/G9jcDBu3JcprcQ HAGdpTHcZpeidDOvusxRLYiA1MV+UmRKp6MtErO63Hb79mCn7PVYKI/OPArvc6E5+UBD ChIsLI68seujV/sSMHHETMHlF3237Ep/umbts= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=3MyYNZ94U9kqmUXktPbHyDE74mj5HBGwqxo8XES1UFM=; b=HEQ2iHx4/5yV/3QYUa188sbtGSl4uhzXk6AQqklDgSEr/r5Mk4Gatc+NmiEPXbZetm HEoguzrn1CYRIB/2JVPDmowOXPdD9tmRE+jlTUe3p84Rqx91XVBPBuNCiduAMUNlEPTl 3flR+a3G4fdY2YlT0B7Nteygex0livP2N1HhTu6+iS3+1nxd9chQT/ft6uJT/Xbk/Pfs YJULE19Dl+fz1bM2JZ0VcBxAkOux3k0I4KcRfQTChVKr50SeXDETIb5misgv42X/pt8k /kaMZ2EL4cUPoLByh22ZJqOf/ucmmBimRmd9Amx0M764Uy/P9QEqMaSS8fM7UidHWlsy VpAw== X-Gm-Message-State: AHQUAuZvwT6VZ85oEtPOaU8aGR2HKfT6+CozpVjdgH7thO8PA+GT9B6u meEnqCnP+3US9L5L8HmvD5u4Pg== X-Received: by 2002:a0c:b988:: with SMTP id v8mr479976qvf.54.1549384935353; Tue, 05 Feb 2019 08:42:15 -0800 (PST) Received: from localhost ([2620:0:1004:1100:cca9:fccc:8667:9bdc]) by smtp.gmail.com with ESMTPSA id f33sm8889074qta.91.2019.02.05.08.42.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Feb 2019 08:42:13 -0800 (PST) Date: Tue, 5 Feb 2019 11:42:13 -0500 From: Joel Fernandes To: Hugo Lefeuvre Cc: Greg Kroah-Hartman , Greg Hartman , Alistair Strachan , Arve =?iso-8859-1?B?SGr4bm5lduVn?= , Todd Kjos , Martijn Coenen , Christian Brauner , Ingo Molnar , Peter Zijlstra , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/3] sched/wait: introduce wait_event_freezable_hrtimeout Message-ID: <20190205164213.GE46829@google.com> References: <647b057e1fef497c591d5009cbb20692e7df9785.1548998323.git.hle@owl.eu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <647b057e1fef497c591d5009cbb20692e7df9785.1548998323.git.hle@owl.eu.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 01, 2019 at 06:38:35AM +0100, Hugo Lefeuvre wrote: > introduce wait_event_freezable_hrtimeout, an interruptible and freezable > version of wait_event_hrtimeout. > > Among others this helper will allow for simplifications in > staging/android/vsoc.c. > > Signed-off-by: Hugo Lefeuvre > --- Reviewed-by: Joel Fernandes (Google) thanks, - Joel > include/linux/wait.h | 25 +++++++++++++++++++++---- > 1 file changed, 21 insertions(+), 4 deletions(-) > > diff --git a/include/linux/wait.h b/include/linux/wait.h > index 5f3efabc36f4..c4cf5113f58a 100644 > --- a/include/linux/wait.h > +++ b/include/linux/wait.h > @@ -483,7 +483,7 @@ do { \ > __ret; \ > }) > > -#define __wait_event_hrtimeout(wq_head, condition, timeout, state) \ > +#define __wait_event_hrtimeout(wq_head, condition, timeout, state, cmd) \ > ({ \ > int __ret = 0; \ > struct hrtimer_sleeper __t; \ > @@ -500,7 +500,7 @@ do { \ > __ret = -ETIME; \ > break; \ > } \ > - schedule()); \ > + cmd); \ > \ > hrtimer_cancel(&__t.timer); \ > destroy_hrtimer_on_stack(&__t.timer); \ > @@ -529,7 +529,23 @@ do { \ > might_sleep(); \ > if (!(condition)) \ > __ret = __wait_event_hrtimeout(wq_head, condition, timeout, \ > - TASK_UNINTERRUPTIBLE); \ > + TASK_UNINTERRUPTIBLE, \ > + schedule()); \ > + __ret; \ > +}) > + > +/* > + * like wait_event_hrtimeout() -- except it uses TASK_INTERRUPTIBLE to avoid > + * increasing load and is freezable. > + */ > +#define wait_event_freezable_hrtimeout(wq_head, condition, timeout) \ > +({ \ > + int __ret = 0; \ > + might_sleep(); \ > + if (!(condition)) \ > + __ret = __wait_event_hrtimeout(wq_head, condition, timeout, \ > + TASK_INTERRUPTIBLE, \ > + freezable_schedule()); \ > __ret; \ > }) > > @@ -555,7 +571,8 @@ do { \ > might_sleep(); \ > if (!(condition)) \ > __ret = __wait_event_hrtimeout(wq, condition, timeout, \ > - TASK_INTERRUPTIBLE); \ > + TASK_INTERRUPTIBLE, \ > + schedule()); \ > __ret; \ > }) > > -- > 2.20.1