Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Jun 2001 17:36:25 +0000 (GMT)
From:      "E.B. Dreger" <eddy+public+spam@noc.everquick.net>
To:        freebsd-smp@freebsd.org, freebsd-hackers@freebsd.org
Subject:   CPU affinity hinting
Message-ID:  <Pine.LNX.4.20.0106291709100.10723-100000@www.everquick.net>

next in thread | raw e-mail | index | archive | help
(Cross-posting again... I'm willing to be larted with a herring if this is
unacceptable for the content presented.)

I was thinking about CPU affinity on SMP systems.... the following is
on-list brainstorming.

Take a two-way box running 10 httpd and 10 smtpd processes.  Assuming
equal CPU time requirements, it would make sense to bind httpd to one CPU,
and smtpd to the other.  Simple, but not realistic.

Maybe smtpd requires more CPU time.  Fine... limit one processor to smtpd,
run leftover smtpd on the other CPU, and run httpd _only_ on the processor
handling leftover smtpd.

Or consider ten instances of a single program that uses four processes,
sort of like squid * 10:  It would make more sense to have similar
processes grouped on the same CPU.

After watching processes switch CPUs via "top", I got to thinking... could
there be, and would it be useful to have, a mechanism where processes
could tell the kernel "my magic number is 6819732", and the kernel would
try to keep all processes with said magic number on the same CPU?

Is this "solution" worse than the problem (cache thrash and switching
CPUs)?

I suppose that the kernel could do a quick, numerically-simple hash of the
ELF metadata, as opposed to program-specified magic.  This would handle
the httpd/smtpd case, with less fear of magic number collisions, but not
rfork(2)ed threads.

Or, instead of hashing ELF metadata, the kernel could compute a hash
based on all IP ports bind(2)ed by the program within the first few
seconds of operation.  (Obviously unsuitable for short-lived programs,
but those could probably be handled via least-busy CPU assignment.)

Perhaps a hybrid approach:

	cpu_hint = hash(elf_metadata, hint) % num_cpus ;

where "hint" is specified by the process in a group?

Thoughts?  Criticisms?  Flames?  Beatings with a stinky fish?


Eddy

---------------------------------------------------------------------------

Brotsman & Dreger, Inc.
EverQuick Internet Division

Phone: +1 (316) 794-8922 Wichita/(Inter)national
Phone: +1 (785) 865-5885 Lawrence

---------------------------------------------------------------------------

Date: Mon, 21 May 2001 11:23:58 +0000 (GMT)
From: A Trap <blacklist@brics.com>
To: blacklist@brics.com
Subject: Please ignore this portion of my mail signature.

These last few lines are a trap for address-harvesting spambots.  Do NOT
send mail to <blacklist@brics.com>, or you are likely to be blocked.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-smp" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.20.0106291709100.10723-100000>