Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp5255667ima; Tue, 5 Feb 2019 08:44:38 -0800 (PST) X-Google-Smtp-Source: AHgI3IbU4Kou0yMHX5y+C65tKSws998+jxDRGstkSTJCuZ+S4C5CYrH3dltM25Le/9VV9IOAqP5d X-Received: by 2002:a62:60c5:: with SMTP id u188mr5914163pfb.4.1549385078775; Tue, 05 Feb 2019 08:44:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549385078; cv=none; d=google.com; s=arc-20160816; b=PL0oM0he2KTiK6EcZoC7lNv41bidLvoPNiJKA3QOxODB3naI/JqwLWs7kCv6nWuM9P n1cOQXz2mTm1LKctSmmbjX9AGsf2mBlikmmcu2KHDIIxzKiaFWoJ5jSzjlhPJoHoIpMC EhfXWqizUH+BFeZhnlfpEjh2qxj4+ztQdxr/m4/HMIxL+gSYMmyTVJu456eSYL/0gf9X 5k40RZTRA9XiQ3nSJPFtqe/wpLS6dr9mEIK14Z7tv6GnsWrh6OAh9Rr31i0htYTNhV6v d0dlyeiIkXAFl0YL76ALM3Kn69RRgbj4mGjGyAjERcH+I5SyvvAXjSNKpvJaXNKoou/H HiWw== 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=IrIiRZr4Bnb8UsADj+9gJXt7XSlyw7YRnrJhcYbXoEc=; b=OLVQ85UJdAqTbd1pq0bN+yaJ6XOUvGCpP8PX04gxOSpAPK/PFyPwTgGW5CQk3d6oqt cLB3Z/0NfAW+7/HY7PtORUFtDu2/6skCxw0Q1EPfKCIJjbCmD1P3TbWANq/taBCNi+oK GHshU3ZcvS5ewe7C1yWRUbWl63J21xC5HyfBdVzXNNF4phO+8w74EJrdhKX0GZrllQDJ kVtuaDVmVSVvZweG+2vsiQRjhwoDoBPZM87caDi6IMGyW0Drlq+KN82xRUXE1T9tOB7n hbYxnSN4pIUD0EsptGCpGwleHat7h1fETYXRsRwrh7xakCx1G3/Rwe7jCVNDQVnHecKp 7xtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=RfAXzpUb; 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 n13si3226794pgp.307.2019.02.05.08.44.23; Tue, 05 Feb 2019 08:44:38 -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=RfAXzpUb; 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 S1729388AbfBEQhm (ORCPT + 99 others); Tue, 5 Feb 2019 11:37:42 -0500 Received: from mail-qt1-f194.google.com ([209.85.160.194]:35255 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726742AbfBEQhm (ORCPT ); Tue, 5 Feb 2019 11:37:42 -0500 Received: by mail-qt1-f194.google.com with SMTP id v11so4542914qtc.2 for ; Tue, 05 Feb 2019 08:37:41 -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=IrIiRZr4Bnb8UsADj+9gJXt7XSlyw7YRnrJhcYbXoEc=; b=RfAXzpUbO+RDhCb5DMyUVG3U5qOtq7asD7BZpXWxD+IMwyHyaD6TDpLQqUm/aVNC5G 6Or3VpkwBWQ57QRkDqQpVcTA1mmfVMwUeykA+3LPVcA9HnZyBCMONmD966PoIGxC58PL Um5RU+2CtMz+9QYKF/WeUIPurJTaeBC2mEioA= 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=IrIiRZr4Bnb8UsADj+9gJXt7XSlyw7YRnrJhcYbXoEc=; b=rqxsisUbVc5ptjoIF3AYjClVFq/1/L5gnUcnoK+6n9QiWrBkbeLMrNYXyAseQREzPB J2L6koW74Eq5jDkFW2Mv6+ku2B4dBgJPJPd1/QHG0qUeSqGG8poe3nDX5u6AGIFDLv+B SMD5izRrQNxYFpTANZ7hmwx5UIgLw7IgWajGqsVMkSqKTzd7NWc19kpAxMMMOSW35G87 MzD4RhLF177T2zwjvB/7SOsZow0V7P1pByTRBVTh/0H9MOVklEApQVHPszztCVrojQH7 V9C4HTrG4xaQkgO4GESRfpoG82wlJNVJT4GfHrS9nV2jKRzW68arlBn3TFnFMd+/cXEK WmdA== X-Gm-Message-State: AHQUAuaEL9Fqm5oeJO6a25ofdpx3BU7RNQJ+ZGCgOmrjlNUXzqGL5uKu E5ErinjamKLTNZV60PF9aCqQQQ== X-Received: by 2002:a0c:e610:: with SMTP id z16mr4449698qvm.81.1549384661472; Tue, 05 Feb 2019 08:37:41 -0800 (PST) Received: from localhost ([2620:0:1004:1100:cca9:fccc:8667:9bdc]) by smtp.gmail.com with ESMTPSA id j129sm7919883qkd.18.2019.02.05.08.37.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Feb 2019 08:37:40 -0800 (PST) Date: Tue, 5 Feb 2019 11:37:39 -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 1/3] sched/wait: use freezable_schedule when possible Message-ID: <20190205163739.GD46829@google.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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:05AM +0100, Hugo Lefeuvre wrote: > Replace schedule(); try_to_freeze() by freezable_schedule(). > > Tasks calling freezable_schedule() set the PF_FREEZER_SKIP flag > before calling schedule(). Unlike tasks calling schedule(); > try_to_freeze() tasks calling freezable_schedule() are not awaken by > try_to_freeze_tasks(). Instead they call try_to_freeze() when they > wake up if the freeze is still underway. > > It is not a problem since sleeping tasks can't do anything which isn't > allowed for a frozen task while sleeping. > > The result is a potential performance gain during freeze, since less > tasks have to be awaken. Reviewed-by: Joel Fernandes (Google) thanks, - Joel > > Signed-off-by: Hugo Lefeuvre > --- > include/linux/wait.h | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/include/linux/wait.h b/include/linux/wait.h > index ed7c122cb31f..5f3efabc36f4 100644 > --- a/include/linux/wait.h > +++ b/include/linux/wait.h > @@ -308,7 +308,7 @@ do { \ > > #define __wait_event_freezable(wq_head, condition) \ > ___wait_event(wq_head, condition, TASK_INTERRUPTIBLE, 0, 0, \ > - schedule(); try_to_freeze()) > + freezable_schedule()) > > /** > * wait_event_freezable - sleep (or freeze) until a condition gets true > @@ -367,7 +367,7 @@ do { \ > #define __wait_event_freezable_timeout(wq_head, condition, timeout) \ > ___wait_event(wq_head, ___wait_cond_timeout(condition), \ > TASK_INTERRUPTIBLE, 0, timeout, \ > - __ret = schedule_timeout(__ret); try_to_freeze()) > + __ret = freezable_schedule_timeout(__ret)) > > /* > * like wait_event_timeout() -- except it uses TASK_INTERRUPTIBLE to avoid > @@ -588,7 +588,7 @@ do { \ > > #define __wait_event_freezable_exclusive(wq, condition) \ > ___wait_event(wq, condition, TASK_INTERRUPTIBLE, 1, 0, \ > - schedule(); try_to_freeze()) > + freezable_schedule()) > > #define wait_event_freezable_exclusive(wq, condition) \ > ({ \ > -- > 2.20.1