Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3791276imm; Mon, 2 Jul 2018 05:46:10 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKZDpI9PTmRM76xj6fMF3Joi6Zv1gCq4eYKL0tjv+6ZWQ9BVHbGhVmj9qZIWm7L84QtvO4b X-Received: by 2002:a17:902:9a01:: with SMTP id v1-v6mr26176119plp.20.1530535570239; Mon, 02 Jul 2018 05:46:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530535570; cv=none; d=google.com; s=arc-20160816; b=rX0jmn2ouJd1/DIC+ogMhGeY7ynwdzE67v833QDPVqTjv6zqwyML0CCImM1FcsTGny zBVeEcLDwK6Ecszqjeks526OIbTP2pzQuIUUvgXtu3AP0G+vmWraUtJcVzwxJbc2ymQn Op2sRU6OoeiYPG7qxYTb05af7kA4L4qkDiuYeSy5yzjKJFzLUtRcxLOtduqPU3m4/XHg KI8WBIN0tAieQ15NVu30FCYbGNUxOsTj5VlnsveHDrgH1YaLssqi3K/ssFxPEQ37h7UV rPUCIAlM6OEujluOGa2oReop4sjiTs+n1JvGdseIieE8XUgWp8ySyK3un/E57qwcxcsH T2jg== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=wEFkXFWTsIbgDU1KgirDRbWQl2B9HIpHVgo3mtiQ20Y=; b=aS/1ieR3L6ii4XLKrmnuXCx/pDTrXX4rpErvvZZrw7ssJrPvczGkw2KHS5kxMfe5QH 0iYlZVjtctEwTPV/WS6P+73iztRFNO6Ps4nYTGXFBmX/8OzAmAfwgWhd82CjYvwc753C +aGoEte0mVgJCxis1UjdBJIIP+xDpXxYC+UcLwz8aVVh0zEVTfqVvYFXe/4o/cvAKIHv fq4KqPv+U1W6kD3A2eAZwURDZW/1RUKkt/6zuSVsAEncLE8rCYnFWfH7WzESZ6bEzsJE Z3+fqAI+snQdxLClXAlli3T/A713FKXshjgl7QZLHhqz5hUVn8Q5f3OKSVXdcEjZzb9q BKkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=L8B+g6id; 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 k6-v6si5365694pgb.446.2018.07.02.05.45.54; Mon, 02 Jul 2018 05:46:10 -0700 (PDT) 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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=L8B+g6id; 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 S933719AbeGBMEC (ORCPT + 99 others); Mon, 2 Jul 2018 08:04:02 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:42528 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753269AbeGBMEB (ORCPT ); Mon, 2 Jul 2018 08:04:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=wEFkXFWTsIbgDU1KgirDRbWQl2B9HIpHVgo3mtiQ20Y=; b=L8B+g6idPlNrEPtAsFJg0SANp5 b6FrQFfKmQGPjZtFJq2dBMKnk1nS5eYPDClPDZmiheyanDe8+jT9W50GsVUOfZbKIOhHRuNWZx/30 bf138/hPBpO/DzEeszUYANehWeci4qG462E8M1WVjblcRNK/31yuWcEefaFDTK2bjGGbvCiaUjzxI OQ+Fm/YRDIF0KDhMLdA4hHNyxYWY7vz4abQEEO8CsglNRBUArc/vnKgbWH/ict94zO9GeE1Bl5o1y 0xdu2LDcCeoaJv9ZYpie3jpblpQKzvn0LvrFam/sGjItH3sUj682v8uh3xxgl23LFxFqxjAxXDLk1 qnwxrlVg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fZxYk-0005lj-UV; Mon, 02 Jul 2018 12:03:59 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id A5A5B20289CE4; Mon, 2 Jul 2018 14:03:56 +0200 (CEST) Date: Mon, 2 Jul 2018 14:03:56 +0200 From: Peter Zijlstra To: =?utf-8?B?546L6LSH?= Cc: Ingo Molnar , linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH] tg: count the sum wait time of an task group Message-ID: <20180702120356.GJ2494@hirez.programming.kicks-ass.net> References: <5c4c978d-e8fb-4bcb-b942-3c6d3dcfc13e@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5c4c978d-e8fb-4bcb-b942-3c6d3dcfc13e@linux.alibaba.com> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 02, 2018 at 03:29:39PM +0800, 王贇 wrote: > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 1866e64..ef82ceb 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -862,6 +862,7 @@ static void update_curr_fair(struct rq *rq) > static inline void > update_stats_wait_end(struct cfs_rq *cfs_rq, struct sched_entity *se) > { > + struct task_group *tg; > struct task_struct *p; > u64 delta; > > @@ -882,6 +883,9 @@ static void update_curr_fair(struct rq *rq) > return; > } > trace_sched_stat_wait(p, delta); > + } else { > + tg = group_cfs_rq(se)->tg; > + __schedstat_add(tg->wait_sum, delta); > } You're joking right? This patch is both broken and utterly insane. You're wanting to update an effectively global variable for every schedule action (and its broken because it is without any serialization or atomics). NAK