From: Peter Zijlstra <peterz@infradead.org>
To: Yafang Shao <laoar.shao@gmail.com>
Cc: mingo@redhat.com, LKML <linux-kernel@vger.kernel.org>,
shaoyafang@didiglobal.com
Subject: Re: [PATCH] sched: fair: fix missed CONFIG_SCHEDSTATS
Date: Wed, 6 Mar 2019 13:38:34 +0100 [thread overview]
Message-ID: <20190306123834.GW32494@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <CALOAHbB7EZ83R3gHcGa9oZWq=7CEgBkL2cXav_7N13u4U44+uA@mail.gmail.com>
On Wed, Mar 06, 2019 at 07:49:36PM +0800, Yafang Shao wrote:
$ grep SCHEDSTAT defconfig-build/.config
# CONFIG_SCHEDSTATS is not set
$ obbjdump -dr defconfig-build/kernel/sched/fair.o | awk '/>:$/ { F=$2 } /sched_stat/ { print F " " $0 }'
<update_curr>: 24cd: R_X86_64_32S __tracepoint_sched_stat_runtime+0x28
<update_curr>: 24d9: R_X86_64_PC32 __tracepoint_sched_stat_runtime+0x24
$ patch -p1 < foo
patching file kernel/sched/fair.c
$ make O=defconfig-build kernel/sched/
make[1]: Entering directory '/usr/src/linux-2.6/defconfig-build'
Using .. as source for kernel
GEN Makefile
CALL ../scripts/checksyscalls.sh
CALL ../scripts/atomic/check-atomics.sh
DESCEND objtool
CC kernel/sched/fair.o
AR kernel/sched/built-in.a
make[1]: Leaving directory '/usr/src/linux-2.6/defconfig-build'
$ objdump -dr defconfig-build/kernel/sched/fair.o | awk '/>:$/ { F=$2 } /sched_stat/ { print F " " $0 }'
$ cat foo
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 8213ff6e365d..6e5ceec3b662 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -839,7 +839,8 @@ static void update_curr(struct cfs_rq *cfs_rq)
if (entity_is_task(curr)) {
struct task_struct *curtask = task_of(curr);
- trace_sched_stat_runtime(curtask, delta_exec, curr->vruntime);
+ if (schedstat_enabled())
+ trace_sched_stat_runtime(curtask, delta_exec, curr->vruntime);
cgroup_account_cputime(curtask, delta_exec);
account_group_exec_runtime(curtask, delta_exec);
}
_1_ line, where you wanted to add _6_ ugly #ifdefs
next prev parent reply other threads:[~2019-03-06 12:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-06 8:43 [PATCH] sched: fair: fix missed CONFIG_SCHEDSTATS Yafang Shao
2019-03-06 10:09 ` Peter Zijlstra
2019-03-06 10:15 ` Yafang Shao
2019-03-06 11:27 ` Peter Zijlstra
2019-03-06 11:49 ` Yafang Shao
2019-03-06 12:38 ` Peter Zijlstra [this message]
2019-03-06 12:53 ` Yafang Shao
2019-03-07 7:49 ` Yafang Shao
2019-03-07 9:55 ` Peter Zijlstra
2019-03-07 10:41 ` Yafang Shao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190306123834.GW32494@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=laoar.shao@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=shaoyafang@didiglobal.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox