cpuset and affinity implementation

Jeff Roberson jroberson at chesapeake.net
Tue Feb 26 01:02:35 UTC 2008


On Mon, 25 Feb 2008, Abdullah Ibn Hamad Al-Marri wrote:

> Jeff this is great!

Thanks!

>
> Would it hit RELENG_7 in the future?

It sounds like there is a lot of interest in that.  If people feel good 
about the api being stable then I will merge it.

Jeff

>
> Regards,
> -Abdullah Ibn Hamad Al-Marri
> Arab Portal
>
>
> ----- Original Message ----
> From: Jeff Roberson <jroberson at chesapeake.net>
> To: current at freebsd.org
> Sent: Monday, February 25, 2008 6:38:37 AM
> Subject: cpuset and affinity implementation
>
>
> Hello,
>
> I
> have
> implemented
> a
> new
> api
> similar
> to
> processors
> sets
> on
> solaris.
> This
> allows
> you
> to
> assign
> processes
> to
> sets
> of
> cpus
> and
> dynamically
> change
> those
> sets.
> This
> is
> useful
> for
> provisioning
> purposes
> to
> add
> and
> remove
> cpu
> resources
> for
> a
> particular
> process
> or
> group
> of
> processes.
> This
> new
> facility
> also
> supports
> binding
> secific
> threads
> to
> specific
> cpus
> which
> some
> applications
> may
> want
> to
> do.
> At
> some
> point
> in
> the
> future
> this
> will
> be
> integrated
> with
> jail
> so
> you
> can
> restrict
> the
> cpus
> any
> jail
> is
> allowed
> to
> use.
>
> This
> api
> should
> not
> be
> considered
> final
> and
> the
> 'cpuset'
> tool
> is
> quite
> rough.
> This
> also
> only
> works
> with
> ULE
> and
> is
> unfortunately
> intertwined
> with
> a
> big
> ULE
> patch
> I've
> been
> working
> on.
> The
> set
> management
> code
> is
> generic
> but
> 4BSD
> doesn't
> contain
> the
> hooks
> to
> actually
> constrain
> threads.
>
> Please
> see:
> http://people.freebsd.org/~jeff/cpuset.diff
>
> here's
> a
> couple
> of
> neat
> things
> to
> do
> with
> cpuset:
>
> cpuset
> -l
> 0-4
> /bin/sh
>
> This
> creates
> a
> new
> group
> with
> a
> list
> (-l)
> of
> cpus
> 0-4
> inclusive
> and
> runs
> sh
> in
> it.
>
> cpuset
> -g
> -p
> <sh
> pid>
>
> This
> will
> get
> (-g)
> the
> mask
> of
> cpus
> pid
> (-p)
> is
> allowed
> to
> run
> on.
>
> cpuset
> -l
> 0,2
> -p
> <sh
> pid>
>
> This
> will
> restrict
> sh
> to
> running
> on
> cpus
> 0,
> 2
> while
> its
> group
> is
> still
> allowed
> 0-4.
>
> cpuset
> -l
> 0,2
> -c
> -p
> <sh
> pid>
>
> This
> will
> modify
> the
> cpuset
> (-c)
> that
> the
> sh
> belongs
> to.
>
> cpuset
> -l
> 0-3
> -s
> 1
>
> This
> will
> modify
> the
> set
> (-s)
> that
> all
> threads
> are
> in
> by
> default
> to
> contain
> the
> first
> 4
> cpus
> leaving
> the
> rest
> idled.
>
> cpuset
> -g
> -i
> -p
> <sh
> pid>
>
> This
> will
> print
> the
> id
> of
> the
> set
> sh
> is
> in.
>
> cpuset
> -s
> <set
> id>
> -p
> <pid>
>
> This
> will
> move
> pid
> into
> the
> specified
> set
> so
> it
> may
> be
> managed
> with
> other
> pids
> in
> that
> set.
>
> Feedback
> is
> appreciated.
>
> Thanks,
> Jeff
> _______________________________________________
> freebsd-current at freebsd.org
> mailing
> list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To
> unsubscribe,
> send
> any
> mail
> to
> "freebsd-current-unsubscribe at freebsd.org"
>
>
>
>
>
>
>
>      ____________________________________________________________________________________
> Looking for last minute shopping deals?
> Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping
> _______________________________________________
> freebsd-current at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe at freebsd.org"
>


More information about the freebsd-current mailing list