> Date: Wed, 16 Mar 2016 22:18:41 -0400
> From: Michael McConville <[email protected]>
>
> Michal Mazurek wrote:
> > On 17:19:39, 2.03.16, Martin Natano wrote:
> > > On Wed, Mar 02, 2016 at 05:07:21PM +0100, Michal Mazurek wrote:
> > > > kern_sched.c:
> > > > - remove unused functions
> > > > - mark static functions as static
> > >
> > > Functions shouldn't be static in the kernel. "In userland,
> > > functions local to one source module should be declared ???static???.
> > > This
> > > should not be done in kernel land since it makes it impossible to use the
> > > kernel debugger." -- style(8)
> >
> > Oh, right.
> >
> > Remove cpuset_clear(), cpuset_add_all() and cpuset_union(), and move
> > some declarations from proc.h to kern_sched.c.
>
> ok mmcc@, pending an ok from someone who works with this code.
Leave them alone. It makes sense to have the complete set of
operations implemented, even if they aren't currently used.
> > Index: sys/kern/kern_sched.c
> > ===================================================================
> > RCS file: /cvs/src/sys/kern/kern_sched.c,v
> > retrieving revision 1.41
> > diff -u -p -r1.41 kern_sched.c
> > --- sys/kern/kern_sched.c 23 Dec 2015 14:51:17 -0000 1.41
> > +++ sys/kern/kern_sched.c 2 Mar 2016 16:37:18 -0000
> > @@ -28,11 +28,18 @@
> >
> > #include <uvm/uvm_extern.h>
> >
> > -void sched_kthreads_create(void *);
> > -
> > -int sched_proc_to_cpu_cost(struct cpu_info *ci, struct proc *p);
> > +void sched_kthreads_create(void *);
> > +int sched_proc_to_cpu_cost(struct cpu_info *ci, struct proc *p);
> > struct proc *sched_steal_proc(struct cpu_info *);
> >
> > +void cpuset_complement(struct cpuset *, struct cpuset *, struct
> > cpuset *);
> > +void cpuset_copy(struct cpuset *, struct cpuset *);
> > +struct cpu_info *cpuset_first(struct cpuset *);
> > +void cpuset_del(struct cpuset *, struct cpu_info *);
> > +void cpuset_init_cpu(struct cpu_info *);
> > +void cpuset_intersection(struct cpuset *t, struct cpuset *,
> > + struct cpuset *);
> > +
> > /*
> > * To help choosing which cpu should run which process we keep track
> > * of cpus which are currently idle and which cpus have processes
> > @@ -717,12 +724,6 @@ cpuset_init_cpu(struct cpu_info *ci)
> > }
> >
> > void
> > -cpuset_clear(struct cpuset *cs)
> > -{
> > - memset(cs, 0, sizeof(*cs));
> > -}
> > -
> > -void
> > cpuset_add(struct cpuset *cs, struct cpu_info *ci)
> > {
> > unsigned int num = CPU_INFO_UNIT(ci);
> > @@ -744,12 +745,6 @@ cpuset_isset(struct cpuset *cs, struct c
> > }
> >
> > void
> > -cpuset_add_all(struct cpuset *cs)
> > -{
> > - cpuset_copy(cs, &cpuset_all);
> > -}
> > -
> > -void
> > cpuset_copy(struct cpuset *to, struct cpuset *from)
> > {
> > memcpy(to, from, sizeof(*to));
> > @@ -765,15 +760,6 @@ cpuset_first(struct cpuset *cs)
> > return (cpuset_infos[i * 32 + ffs(cs->cs_set[i]) - 1]);
> >
> > return (NULL);
> > -}
> > -
> > -void
> > -cpuset_union(struct cpuset *to, struct cpuset *a, struct cpuset *b)
> > -{
> > - int i;
> > -
> > - for (i = 0; i < CPUSET_ASIZE(ncpus); i++)
> > - to->cs_set[i] = a->cs_set[i] | b->cs_set[i];
> > }
> >
> > void
> > Index: sys/sys/proc.h
> > ===================================================================
> > RCS file: /cvs/src/sys/sys/proc.h,v
> > retrieving revision 1.213
> > diff -u -p -r1.213 proc.h
> > --- sys/sys/proc.h 6 Dec 2015 17:50:21 -0000 1.213
> > +++ sys/sys/proc.h 2 Mar 2016 15:56:33 -0000
> > @@ -205,9 +205,9 @@ struct process {
> >
> > struct uprof { /* profile arguments */
> > caddr_t pr_base; /* buffer base */
> > - size_t pr_size; /* buffer size */
> > + size_t pr_size; /* buffer size */
> > u_long pr_off; /* pc offset */
> > - u_int pr_scale; /* pc scaling */
> > + u_int pr_scale; /* pc scaling */
> > } ps_prof;
> >
> > u_short ps_acflag; /* Accounting flags. */
> > @@ -215,8 +215,8 @@ struct process {
> > uint64_t ps_pledge;
> > struct whitepaths *ps_pledgepaths;
> >
> > - int64_t ps_kbind_cookie;
> > - u_long ps_kbind_addr;
> > + int64_t ps_kbind_cookie;
> > + u_long ps_kbind_addr;
> >
> > /* End area that is copied on creation. */
> > #define ps_endcopy ps_refcnt
> > @@ -255,7 +255,7 @@ struct process {
> > #define PS_EMBRYO 0x00020000 /* New process, not yet fledged
> > */
> > #define PS_ZOMBIE 0x00040000 /* Dead and ready to be waited
> > for */
> > #define PS_NOBROADCASTKILL 0x00080000 /* Process excluded from kill
> > -1. */
> > -#define PS_PLEDGE 0x00100000 /* Has called pledge(2) */
> > +#define PS_PLEDGE 0x00100000 /* Has called pledge(2) */
> >
> > #define PS_BITS \
> > ("\20" "\01CONTROLT" "\02EXEC" "\03INEXEC" "\04EXITING" "\05SUGID" \
> > @@ -380,12 +380,12 @@ struct proc {
> > #define P_WEXIT 0x00002000 /* Working on exiting. */
> > #define P_OWEUPC 0x00008000 /* Owe proc an addupc() at next
> > ast. */
> > #define P_SUSPSINGLE 0x00080000 /* Need to stop for single
> > threading. */
> > -#define P_SYSTRACE 0x00400000 /* Process system call tracing active*/
> > -#define P_CONTINUED 0x00800000 /* Proc has continued from a
> > stopped state. */
> > +#define P_SYSTRACE 0x00400000 /* Process system call tracing
> > active*/
> > +#define P_CONTINUED 0x00800000 /* Proc has continued from a
> > stopped state. */
> > #define P_THREAD 0x04000000 /* Only a thread, not a real
> > process */
> > #define P_SUSPSIG 0x08000000 /* Stopped from signal. */
> > #define P_SOFTDEP 0x10000000 /* Stuck processing softdep
> > worklist */
> > -#define P_CPUPEG 0x40000000 /* Do not move to another cpu. */
> > +#define P_CPUPEG 0x40000000 /* Do not move to another cpu.
> > */
> >
> > #define P_BITS \
> > ("\20" "\01INKTR" "\02PROFPEND" "\03ALRMPEND" "\04SIGSUSPEND" \
> > @@ -414,7 +414,7 @@ struct uidinfo *uid_find(uid_t);
> > #define PID_MAX 32766
> > #define NO_PID (PID_MAX+1)
> >
> > -#define SESS_LEADER(pr) ((pr)->ps_session->s_leader == (pr))
> > +#define SESS_LEADER(pr) ((pr)->ps_session->s_leader == (pr))
> > #define SESSHOLD(s) ((s)->s_count++)
> > #define SESSRELE(s) do {
> > \
> > if (--(s)->s_count == 0) \
> > @@ -558,19 +558,8 @@ struct cpuset {
> > int cs_set[CPUSET_SSIZE];
> > };
> >
> > -void cpuset_init_cpu(struct cpu_info *);
> > -
> > -void cpuset_clear(struct cpuset *);
> > -void cpuset_add(struct cpuset *, struct cpu_info *);
> > -void cpuset_del(struct cpuset *, struct cpu_info *);
> > -int cpuset_isset(struct cpuset *, struct cpu_info *);
> > -void cpuset_add_all(struct cpuset *);
> > -void cpuset_copy(struct cpuset *, struct cpuset *);
> > -void cpuset_union(struct cpuset *, struct cpuset *, struct cpuset *);
> > -void cpuset_intersection(struct cpuset *t, struct cpuset *, struct cpuset
> > *);
> > -void cpuset_complement(struct cpuset *, struct cpuset *, struct cpuset *);
> > -struct cpu_info *cpuset_first(struct cpuset *);
> > +void cpuset_add(struct cpuset *, struct cpu_info *);
> > +int cpuset_isset(struct cpuset *, struct cpu_info *);
> >
> > #endif /* _KERNEL */
> > #endif /* !_SYS_PROC_H_ */
> > -
> >
> > --
> > Michal Mazurek
> >
>
>