Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp4015238imb; Wed, 6 Mar 2019 03:13:08 -0800 (PST) X-Google-Smtp-Source: APXvYqwWHPZ6jPePrwcAqVUyUSfTxrCyqIHZJA/l82sVfVeAB5D9Azp4Y2k9gqtAiuS+lom3ToDM X-Received: by 2002:aa7:8059:: with SMTP id y25mr6646249pfm.74.1551870787991; Wed, 06 Mar 2019 03:13:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551870787; cv=none; d=google.com; s=arc-20160816; b=wi0eyvV4nSmFJOVLOuupT6FlwNZEScssIsJBpj5niY1B3XNxKchl3G20d/vyMFy7rA XqM65vAJ/VqDa/dVqmRhr8F1J5h7Nh7buSXIK8isFdgs5xosQl2t8DD2EayX+dIqd5F4 bpT1V1vZkCCuiGk/nzyDKJjXsTWMGchyzGeVCfMqbPBywUhj0DwN+9dyDT1ZEcjGZ3f3 ScsCh4st2VTmNFZzbZs3vpmHwTOqT1Q2gfI2O4fVmm72+jHxnHFwWGDLT0hjB9LRxDcS DMX9h/ZbPfTqr3fKv0X0iHyQcErt1GI9U8vyKVNZvCIhd47blhsjtoIlzUVwg4AnT9YG VqUg== 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=mbAFQfrua3LFcwC9n1LQJ6VRsjyd4tKMk9+m8oI3H4M=; b=SlzQXMqlLhFds7CimArx4cqd7blD8X4355MZnrsc9hFUhBbEinyZWaq97240K67pZQ 64BHv5hFgWeyTdoR8witSNBdQuCzlwzmblHpCc8fkE4Pu5eA8h0txmYfjGbwJBVAOfUm nNEVPJ1MOvBhb5IFR4hWqeNLaiZLxRFSfnP35xSv98rTLXw1VPzbF/Nwc/dBYNig4D52 vgoImXXCnnGbYMeqRBs/AqgmuMWo6lnPhys01zlhteaZJVgoodIQW5K0crYma5HksfG/ JJZ5R71jsx9yvXYIecBYL7ehPGQF5R8e0Mg4/eZXVnELa2X7lSWSGedD1zWZvjPkrNTU CH9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=csMyyHvS; 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 f21si1167216pgv.28.2019.03.06.03.12.52; Wed, 06 Mar 2019 03:13:07 -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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=csMyyHvS; 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 S1730103AbfCFKJU (ORCPT + 99 others); Wed, 6 Mar 2019 05:09:20 -0500 Received: from merlin.infradead.org ([205.233.59.134]:40792 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730078AbfCFKJT (ORCPT ); Wed, 6 Mar 2019 05:09:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding: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=mbAFQfrua3LFcwC9n1LQJ6VRsjyd4tKMk9+m8oI3H4M=; b=csMyyHvSAlxvrvq/yaA8F2Tug r9yI8HVLTpgG7gX224QuFDN+nW0r9O3IcqEnkRcLl3GQvE5ZaTgVnfrSW1iQ/kCpq0q77h1vR9a05 +hD+1BV+oTzYopRspAn0EdEZ1bQwUGV2SDJ8eVPLfSpi52j58QINgYH04m65x+zZbt4+fJQjtWHC6 3xNcML/xQGwXAjQMv6zEcxgHmpAWvwNOK0A6S+FbO9GRSyT1MnPqeblZhgL2TLBz1QRWV3gkaePOS 4yU1YnANPNGXB7KiIHLZc7/753zDtW1bZ9jt4ZfFBndh6EZHoUyjODtnHoZQFpIijTM0M/jgjZCxW Lozw11pnw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1h1TU5-0001Yp-Rb; Wed, 06 Mar 2019 10:09:10 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 2290D2029E064; Wed, 6 Mar 2019 11:09:07 +0100 (CET) Date: Wed, 6 Mar 2019 11:09:07 +0100 From: Peter Zijlstra To: Yafang Shao Cc: mingo@redhat.com, linux-kernel@vger.kernel.org, shaoyafang@didiglobal.com Subject: Re: [PATCH] sched: fair: fix missed CONFIG_SCHEDSTATS Message-ID: <20190306100907.GT32477@hirez.programming.kicks-ass.net> References: <1551861826-12592-1-git-send-email-laoar.shao@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1551861826-12592-1-git-send-email-laoar.shao@gmail.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 Wed, Mar 06, 2019 at 04:43:46PM +0800, Yafang Shao wrote: > When I'm using trace_sched_stat_{iowait, blocked, wait, sleep} to > measure how long the processes are stalled, there's always no output from > trace_pipe while there're really some tasks in uninterruptible sleep > state. That makes me confused, so I try to investigate why. > Finally I find the reason is that CONFIG_SCHEDSTATS is not set. > > To avoid such kind of confusion, we should not expose these tracepoints > if CONFIG_SCHEDSTATS is not set. Yeah, lets not sprinkle #ifdef. Big fat NAK. Also, the below seem to indicate your compiler is stupid. Without CONFIG_SCHEDSTAT, schedstat_enabled() should be a constant 0 and DCE should delete all code. > @@ -976,6 +982,7 @@ static void update_curr_fair(struct rq *rq) > static inline void > update_stats_enqueue(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags) > { > +#ifdef CONFIG_SCHEDSTATS > if (!schedstat_enabled()) > return; > > @@ -988,12 +995,13 @@ static void update_curr_fair(struct rq *rq) > > if (flags & ENQUEUE_WAKEUP) > update_stats_enqueue_sleeper(cfs_rq, se); > +#endif > } > > static inline void > update_stats_dequeue(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags) > { > - > +#ifdef CONFIG_SCHEDSTATS > if (!schedstat_enabled()) > return; > > @@ -1014,6 +1022,7 @@ static void update_curr_fair(struct rq *rq) > __schedstat_set(se->statistics.block_start, > rq_clock(rq_of(cfs_rq))); > } > +#endif > } > > /* > @@ -4090,6 +4099,7 @@ static void clear_buddies(struct cfs_rq *cfs_rq, struct sched_entity *se) > update_stats_curr_start(cfs_rq, se); > cfs_rq->curr = se; > > +#ifdef CONFIG_SCHEDSTATS > /* > * Track our maximum slice length, if the CPU's load is at > * least twice that of our own weight (i.e. dont track it > @@ -4100,6 +4110,7 @@ static void clear_buddies(struct cfs_rq *cfs_rq, struct sched_entity *se) > max((u64)schedstat_val(se->statistics.slice_max), > se->sum_exec_runtime - se->prev_sum_exec_runtime)); > } > +#endif > > se->prev_sum_exec_runtime = se->sum_exec_runtime; > } > -- > 1.8.3.1 >