All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jérôme Carretero" <cJ-ko@zougloub.eu>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: tglx@linutronix.de
Subject: Q: Process creation and soft hot CPU affinity
Date: Wed, 23 Nov 2011 15:52:43 -0500	[thread overview]
Message-ID: <20111123155243.46421a6d@Bidule> (raw)

Hi,

I noticed something this night.
The process executions during a ./configure get spread among all the machine CPUs.
When launching processes sequentially, why aren't they put to run on the same CPU ?
I naively assume that the CPU has just finished its work and it's "hot".
The others could continue resting in their C-states/P-states, or whatever.

To measure the performance impact of the current scheduling choices, I ran a little benchmark.
I ran a time ./configure with/without cgroup CPU affinity and got significant difference.

benchmark_setup() {
  cgrp=1cpu
  ncpus=8
  cgroup_mnt=/sys/fs/cgroup
  coreutils_tar=/var/paludis/distfiles/coreutils-8.13.tar.xz

  mkdir -p $cgroup_mnt/$cgrp
  echo 0 > $cgroup_mnt/$cgrp/cpuset.mems
  echo $$ > $cgroup_mnt/$cgrp/tasks

  cd /dev/shm
}

benchmark() {
  tar xf $coreutils_tar

  pushd coreutils* > /dev/null
  echo $* > $cgroup_mnt/$cgrp/cpuset.cpus
  echo 3 > /proc/sys/vm/drop_caches
  time sh ./configure > /dev/null
  popd > /dev/null

  rm -rf coreutils*
}

benchmark 0
benchmark $(cat $cgroup_mnt/cpuset.cpus)

Results:

with affinity to 1CPU:
real    0m40.229s
user    0m15.222s
sys     0m9.409s

with affinity to all CPUs:
real    1m20.832s
user    0m31.089s
sys     0m37.582s

Is there something that can be done ?
I just want to start a discussion on this matter, perhaps I'll play with the scheduler if I get a few hints.

Regards,

-- 
cJ
3.2.0-rc2-Bidule-00400-g866d43c #1 SMP PREEMPT Tue Nov 22 13:51:00 EST 2011 x86_64

                 reply	other threads:[~2011-11-23 21:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20111123155243.46421a6d@Bidule \
    --to=cj-ko@zougloub.eu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.