On Monday 20 February 2006 16:02, Peter Williams wrote: [snip description] Hi peter, I've had a good look and have just a couple of comments: --- #endif int prio, static_prio; +#ifdef CONFIG_SMP + int load_weight; /* for load balancing purposes */ +#endif --- Can this be moved up to be part of the other ifdef CONFIG_SMP? Not highly significant since it's in a .h file but looks a tiny bit nicer. --- +/* + * Priority weight for load balancing ranges from 1/20 (nice==19) to 459/20 (RT + * priority of 100). + */ +#define NICE_TO_LOAD_PRIO(nice) \ + ((nice >= 0) ? (20 - (nice)) : (20 + (nice) * (nice))) +#define LOAD_WEIGHT(lp) \ + (((lp) * SCHED_LOAD_SCALE) / NICE_TO_LOAD_PRIO(0)) +#define NICE_TO_LOAD_WEIGHT(nice) LOAD_WEIGHT(NICE_TO_LOAD_PRIO(nice)) +#define PRIO_TO_LOAD_WEIGHT(prio) NICE_TO_LOAD_WEIGHT(PRIO_TO_NICE(prio)) +#define RTPRIO_TO_LOAD_WEIGHT(rp) \ + LOAD_WEIGHT(NICE_TO_LOAD_PRIO(-20) + (rp)) --- The weighting seems not related to anything in particular apart from saying that -nice values are more heavily weighted. Since you only do this when setting the priority of tasks can you link it to the scale of (SCHED_NORMAL) tasks' timeslice instead even though that will take a fraction more calculation? RTPRIO_TO_LOAD_WEIGHT is fine since there isn't any obvious cpu proportion relationship to rt_prio level. Otherwise, good work, thanks! > Signed-off-by: Peter Williams <[email protected]> Signed-off-by: Con Kolivas <[email protected]> Cheers, Con
Attachment:
pgp8D1FAa9crn.pgp
Description: PGP signature
- Follow-Ups:
- Re: [PATCH] sched: Consolidated and improved smpnice patch
- From: Peter Williams <[email protected]>
- Re: [PATCH] sched: Consolidated and improved smpnice patch
- References:
- [PATCH] sched: Consolidated and improved smpnice patch
- From: Peter Williams <[email protected]>
- [PATCH] sched: Consolidated and improved smpnice patch
- Prev by Date: Re: Which is simpler? (Was Re: [Suspend2-devel] Re: [ 00/10] [Suspend2] Modules support.)
- Next by Date: Re: (pspace,pid) vs true pid virtualization
- Previous by thread: [PATCH] sched: Consolidated and improved smpnice patch
- Next by thread: Re: [PATCH] sched: Consolidated and improved smpnice patch
- Index(es):