Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1538569

Re: [PATCH 03/10] perf sched timehist: Handle zero sample->tid properly

From Namhyung Kim <namhyung@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH 03/10] perf sched timehist: Handle zero sample->tid properly
Date 2016-12-08 15:30 +0100
Message-ID <sM7RT-7ch-7@gated-at.bofh.it> (permalink)
References <sLeVr-55B-3@gated-at.bofh.it> <sLeVs-55B-23@gated-at.bofh.it> <sLf57-58I-7@gated-at.bofh.it> <sLA9A-1Ws-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Dec 07, 2016 at 11:06:29AM +0900, Namhyung Kim wrote:
> On Mon, Dec 05, 2016 at 07:52:57PM -0800, David Ahern wrote:
> > On 12/5/16 7:40 PM, Namhyung Kim wrote:
> > > Sometimes samples have tid of 0 but non-0 pid.  It ends up having a
> > 
> > Any idea how that happens?
> 
> It seems that an exiting task wakes up its parent and the parent might
> call wait(2) concurrently.  So at the time of calling last schedule(),
> its pid (and tgid) link might be unhashed by the parent and can have 0
> sample->tid and/or sample->pid depending on timing IMHO.  Not sure
> anything guarantees that the sample tid/pid is preserved during the
> event.  From a quick look I couldn't find..

I found following line in my data file.

  $ perf script --time 52460.536907,
  swapper     0 [000] 52460.536907:       sched:sched_switch: pool:3775 [120] x ==> at-spi2-registr:1961 [120]
                    7f3963 __schedule (/lib/modules/4.8.3-1-ARCH/build/vmlinux)
                    7f3d7c schedule (/lib/modules/4.8.3-1-ARCH/build/vmlinux)
                    280b14 do_exit (/lib/modules/4.8.3-1-ARCH/build/vmlinux)
                    280fa7 [unknown] (/lib/modules/4.8.3-1-ARCH/build/vmlinux)
                    7f7cf2 entry_SYSCALL_64_fastpath (/lib/modules/4.8.3-1-ARCH/build/vmlinux)
  ...

As you can see task 3775 called schedule() during exit but sample tid
was 0.  In this case prev_pid is still correct (though it's always pid
in the root namespace) since its number was saved in task_struct at the
time of creation and not changed.

I'll change to check prev_pid for idle task.

Thanks,
Namhyung

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 03/10] perf sched timehist: Handle zero sample->tid properly Namhyung Kim <namhyung@kernel.org> - 2016-12-06 04:50 +0100
  Re: [PATCH 03/10] perf sched timehist: Handle zero sample->tid  properly David Ahern <dsahern@gmail.com> - 2016-12-06 05:00 +0100
    Re: [PATCH 03/10] perf sched timehist: Handle zero sample->tid properly Namhyung Kim <namhyung@kernel.org> - 2016-12-06 05:10 +0100
      Re: [PATCH 03/10] perf sched timehist: Handle zero sample->tid  properly David Ahern <dsahern@gmail.com> - 2016-12-06 05:10 +0100
    Re: [PATCH 03/10] perf sched timehist: Handle zero sample->tid  properly Namhyung Kim <namhyung@kernel.org> - 2016-12-07 03:30 +0100
      Re: [PATCH 03/10] perf sched timehist: Handle zero sample->tid  properly Namhyung Kim <namhyung@kernel.org> - 2016-12-08 15:30 +0100
  [tip:perf/core] perf sched timehist: Handle zero sample->tid  properly tip-bot for Namhyung Kim <tipbot@zytor.com> - 2016-12-07 19:30 +0100

csiph-web