Download raw body.
de-macro new_vmcmd()
There used to be more debug code in this layer, and it was removed.
I agree.
Jonathan Gray <jsg@jsg.id.au> wrote:
> unconditionally use new_vmcmd(), not only in the DEBUG path
> putting the function in a define is messy with no benefit
>
> on mac mini m1, make -j8 build
>
> before:
> 72m17.76s real 313m01.65s user 73m46.92s system
> after:
> 72m11.49s real 313m00.97s user 74m37.44s system
>
> Index: sys/sys/exec.h
> ===================================================================
> RCS file: /cvs/src/sys/sys/exec.h,v
> diff -u -p -r1.55 exec.h
> --- sys/sys/exec.h 16 Oct 2024 18:47:48 -0000 1.55
> +++ sys/sys/exec.h 1 Nov 2024 10:23:53 -0000
> @@ -161,7 +161,6 @@ int check_exec(struct proc *, struct exe
> int exec_setup_stack(struct proc *, struct exec_package *);
> int exec_process_vmcmds(struct proc *, struct exec_package *);
>
> -#ifdef DEBUG
> void new_vmcmd(struct exec_vmcmd_set *evsp,
> int (*proc)(struct proc *p, struct exec_vmcmd *),
> u_long len, u_long addr, struct vnode *vp, u_long offset,
> @@ -170,25 +169,6 @@ void new_vmcmd(struct exec_vmcmd_set *ev
> new_vmcmd(evsp,proc,len,addr,vp,offset,prot, 0);
> #define NEW_VMCMD2(evsp,proc,len,addr,vp,offset,prot,flags) \
> new_vmcmd(evsp,proc,len,addr,vp,offset,prot,flags)
> -#else /* DEBUG */
> -#define NEW_VMCMD(evsp,proc,len,addr,vp,offset,prot) \
> - NEW_VMCMD2(evsp,proc,len,addr,vp,offset,prot,0)
> -#define NEW_VMCMD2(evsp,proc,len,addr,vp,offset,prot,flags) do { \
> - struct exec_vmcmd *__vcp; \
> - if ((evsp)->evs_used >= (evsp)->evs_cnt) \
> - vmcmdset_extend(evsp); \
> - __vcp = &(evsp)->evs_cmds[(evsp)->evs_used++]; \
> - __vcp->ev_proc = (proc); \
> - __vcp->ev_len = (len); \
> - __vcp->ev_addr = (addr); \
> - if ((__vcp->ev_vp = (vp)) != NULLVP) \
> - vref(vp); \
> - __vcp->ev_offset = (offset); \
> - __vcp->ev_prot = (prot); \
> - __vcp->ev_flags = (flags); \
> -} while (0)
> -
> -#endif /* DEBUG */
>
> /* Initialize an empty vmcmd set */
> #define VMCMDSET_INIT(vmc) do { \
> Index: sys/kern/exec_subr.c
> ===================================================================
> RCS file: /cvs/src/sys/kern/exec_subr.c,v
> diff -u -p -r1.67 exec_subr.c
> --- sys/kern/exec_subr.c 2 Apr 2024 08:39:16 -0000 1.67
> +++ sys/kern/exec_subr.c 1 Nov 2024 10:23:53 -0000
> @@ -42,14 +42,11 @@
>
> #include <uvm/uvm_extern.h>
>
> -#ifdef DEBUG
> /*
> * new_vmcmd():
> * create a new vmcmd structure and fill in its fields based
> * on function call arguments. make sure objects ref'd by
> * the vmcmd are 'held'.
> - *
> - * If not debugging, this is a macro, so it's expanded inline.
> */
>
> void
> @@ -71,7 +68,6 @@ new_vmcmd(struct exec_vmcmd_set *evsp,
> vcp->ev_prot = prot;
> vcp->ev_flags = flags;
> }
> -#endif /* DEBUG */
>
> void
> vmcmdset_extend(struct exec_vmcmd_set *evsp)
>
de-macro new_vmcmd()