From: Joe Korty <joe.korty@ccur.com>
To: Andrew Morton <akpm@osdl.org>
Cc: torvalds@osdl.org, linux-kernel@vger.kernel.org, rml@tech9.net
Subject: Re: [PATCH] protect migration/%d etc from sched_setaffinity
Date: Thu, 31 Jul 2003 20:01:14 -0400 [thread overview]
Message-ID: <20030801000113.GF7852@rudolph.ccur.com> (raw)
In-Reply-To: <20030731161703.210470ea.akpm@osdl.org>
On Thu, Jul 31, 2003 at 04:17:03PM -0700, Andrew Morton wrote:
> Joe Korty <joe.korty@ccur.com> wrote:
> >
> > I'd like to be able to write shell scrips that operate on the set of
> > /proc/[0-9]* without having to know which of the ever-changing list
> > of processes need to be avoided and which not.
>
> Like this?
>
> #!/bin/sh
>
> #
> # can_set_affinity pid
> #
> can_set_affinity()
> {
> if [ "$(cat /proc/$1/maps)" != "" ]
> then
> return 0
> fi
> if head -1 /proc/$1/status | egrep "events|migration"
> then
> return 1
> else
> return 0
> fi
> }
>
> if can_set_affinity $1
> then
> echo can set affinity of pid $1
> else
> echo cannot set affinity of pid $1
> fi
Good stuff. I reduced it to (having trouble easily reading the original
output):
name=$(head -1 /proc/$1/status | awk '{print $2}')
echo -n '[' $1 '] ' $name ' '
if [ "$(cat /proc/$1/maps)" == "" ]
then
echo SAFE
else
echo changeable
fi
It catches all those that need catching, plus denies changes to some
daemons that could survive sched_setaffinity: khubd, kirqd, pdflush*,
kswapd0, scsi_eh_[01], ahc_dv_[01], kseriod, and kjournald*.
Joe
next prev parent reply other threads:[~2003-08-01 0:01 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-31 22:46 [PATCH] protect migration/%d etc from sched_setaffinity Joe Korty
2003-07-31 22:47 ` Andrew Morton
2003-07-31 23:11 ` Joe Korty
2003-07-31 23:17 ` Andrew Morton
2003-07-31 23:41 ` Robert Love
2003-08-01 0:01 ` Joe Korty [this message]
2003-07-31 23:02 ` Robert Love
2003-07-31 23:06 ` Joe Korty
2003-07-31 23:18 ` Robert Love
2003-07-31 23:16 ` Joe Korty
2003-07-31 23:27 ` Robert Love
2003-07-31 23:26 ` Joe Korty
2003-07-31 23:18 ` [OT] " J.A. Magallon
2003-07-31 23:37 ` Robert Love
2003-08-01 11:09 ` Eric W. Biederman
2003-08-01 16:15 ` Jamie Lokier
2003-08-01 17:31 ` Eric W. Biederman
2003-08-01 17:55 ` Jamie Lokier
2003-08-01 18:39 ` Sean Estabrooks
2003-08-01 17:37 ` Robert Love
[not found] <20030731224604.GA24887@tsunami.ccur.com.suse.lists.linux.kernel>
2003-07-31 23:17 ` Andi Kleen
2003-07-31 23:30 ` Joe Korty
-- strict thread matches above, loose matches on Subject: below --
2003-08-01 10:26 Mikael Pettersson
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=20030801000113.GF7852@rudolph.ccur.com \
--to=joe.korty@ccur.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rml@tech9.net \
--cc=torvalds@osdl.org \
/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.