Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1746918ybl; Sat, 25 Jan 2020 07:33:32 -0800 (PST) X-Google-Smtp-Source: APXvYqzLZCS/tV6N50rpQTJc25B1F5yfsdD+KATqKjDyZ+dzJaCT1nezDLnz6WrvIgIAFakexPpT X-Received: by 2002:a05:6808:251:: with SMTP id m17mr2664170oie.15.1579966412229; Sat, 25 Jan 2020 07:33:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579966412; cv=none; d=google.com; s=arc-20160816; b=YzBe1ZHfINxgXVQaUHvHqbMSUhP3SBBLevfV4DOd6YXJUT6+qADwBoWB7uAOiaN5sP XDrFbg83tMVEeVR5SS0H2FnwazxYSgXNzV8duWRP+GjrTcOyWKN/gmbcZ6RdmESQmh5z VozjPnfDOHbtzFLdnVnjRaWsNGMLDEr4IynPFlPFRW543/+w3hnyJ0khyESoVUwV//fZ f4rEBB4jfKss4g9j5STcj3CX8FDpLeRX5jKblfx6Yp2JrtUN63IdMzt6izdBeIhkGpbs 8G3r0kt1s99IQsfrz5KUp4ElcvErgltBlEb5P+/doeFU/G57xJIpkKGTauEz8KKV7LGM 9PJw== 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=8KP2c213igfgkw0KmFxPUN0yTObRVyryH62ZDiOL/10=; b=yIIkjBxPovh/CZ/7Qg9rZ3j/fqBruqW36TiaqTspLjwr4nANqHteBh4m1CZbPWK0WE aThntk1xQL8CZlNAwEUoEqNBl1bM0b4noQiozXYrkZC6uJoI+pjcKZJ3ErL86bXDYqdr YRrNyVLH1n8/rOFU4GqsTT2A5gDgzZ8N8vjSnApDvzu2fiAwpn55wMhV0WktnTUKG5VG Ie4+8yGCqMpjtueKJfpZvpcBvJmPnK6hHqk+H2UPdB/2LAHWHeJUUT8dHFYaVAvTDBgl 4d6M+JD2jvQSOHgNJuPRk2GturxL4z1ePdoV8P1t6ghZhWX0cnk4V+WbldJZtw+tY723 lipg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fRlwotb4; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m19si100486otr.18.2020.01.25.07.33.20; Sat, 25 Jan 2020 07:33:32 -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=@gmail.com header.s=20161025 header.b=fRlwotb4; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726703AbgAYPcP (ORCPT + 99 others); Sat, 25 Jan 2020 10:32:15 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:33013 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725710AbgAYPcP (ORCPT ); Sat, 25 Jan 2020 10:32:15 -0500 Received: by mail-lj1-f195.google.com with SMTP id y6so5958058lji.0 for ; Sat, 25 Jan 2020 07:32:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=8KP2c213igfgkw0KmFxPUN0yTObRVyryH62ZDiOL/10=; b=fRlwotb4IXszTUfIKDL+N3NEH84rENpRkT7qKhO1exf1puDJtmHR+rwY/GFtbP8SYz IruoJVuzZBIeUkOoLOnItlQCynFVwr2b2Z/mE73H5/PpX71cKaGYCa5SAug2aoAjGTSr MZaPGFFShGSh2FPMIGmMw5knyr6WjTGSIEQumsEgW2jzE5m8jLwiZd5mSgP68lqBq/fV PdgKxXtEnQe/Y3DD8a0YFL4/MolACZAJDUFrXuMlqm6N/Ys3XBqsEw6GXQO+iIzmOZfp snlDQ9RR4cyQnmDeGySZZUbR99Z17wjO9k0fFgAzVOe2eyvYcUe4NDyRWlTqjJXB34Be bOyQ== 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=8KP2c213igfgkw0KmFxPUN0yTObRVyryH62ZDiOL/10=; b=ftObZ/alQXg61sYDJ8Y4BarOLSu2w4cDUl2EnURw/GKiUxFhweX8tiLJfNe1/YIzbn 2PmpvaDyOFDt5jTZuzxWjzy4sIxUktZFkwAj2Vsr9mcaDhCH4KI+t0o0kyV5HMotmzi0 KDcRWsVeXJTr24EtqDwzELklKQD+wlnzZgdJYIxxWi7UYPNVLBmitP88I01ExFYBo5P1 DUQr8hmeoOA5dY+eyHnN0gG/Qugt+tCGHA+CyvO8fDf1OXTPIqJ313QBT0S7/Wz/+oN7 r3kStZMkW00KxaeZqeDLU0l/Y54yDef2yDLcp0obfmHqLl36MEzgOioiqOR+7Vb9KRY5 Ernw== X-Gm-Message-State: APjAAAWytepRSw51GniJDSVNFOsuORlZHT5Rti/wRrQ/6GHMyllcU/jU 6IrtqVu1PsNbdTjlAgvsZtA= X-Received: by 2002:a2e:870b:: with SMTP id m11mr5366102lji.93.1579966333414; Sat, 25 Jan 2020 07:32:13 -0800 (PST) Received: from uranus.localdomain ([5.18.171.94]) by smtp.gmail.com with ESMTPSA id w6sm4825027lfq.95.2020.01.25.07.32.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Jan 2020 07:32:12 -0800 (PST) Received: by uranus.localdomain (Postfix, from userid 1000) id ABF12461625; Sat, 25 Jan 2020 18:32:11 +0300 (MSK) Date: Sat, 25 Jan 2020 18:32:11 +0300 From: Cyrill Gorcunov To: Konstantin Khlebnikov Cc: linux-kernel@vger.kernel.org, Juri Lelli , Vincent Guittot , Peter Zijlstra , Steven Rostedt , Ben Segall , Ingo Molnar , Mel Gorman , Dietmar Eggemann Subject: Re: [PATCH] sched/rt: optimize checking group rt scheduler constraints Message-ID: <20200125153211.GP2437@uranus> References: <157996383820.4651.11292439232549211693.stgit@buzz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <157996383820.4651.11292439232549211693.stgit@buzz> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jan 25, 2020 at 05:50:38PM +0300, Konstantin Khlebnikov wrote: ... > -/* Must be called with tasklist_lock held */ > static inline int tg_has_rt_tasks(struct task_group *tg) > { > - struct task_struct *g, *p; > + struct task_struct *task; > + struct css_task_iter it; > + int ret = 0; > > /* > * Autogroups do not have RT tasks; see autogroup_create(). > @@ -2407,12 +2408,12 @@ static inline int tg_has_rt_tasks(struct task_group *tg) > if (task_group_is_autogroup(tg)) > return 0; > > - for_each_process_thread(g, p) { > - if (rt_task(p) && task_group(p) == tg) > - return 1; > - } > + css_task_iter_start(&tg->css, 0, &it); > + while (!ret && (task = css_task_iter_next(&it))) > + ret |= rt_task(task); Plain 'ret = rt_task(task);' won't work? > + css_task_iter_end(&it); > > - return 0; > + return ret; > }