Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Apr 2006 17:13:18 +0300
From:      Giorgos Keramidas <keramida@FreeBSD.org>
To:        Jiawei Ye <leafy7382@gmail.com>
Cc:        John-Mark Gurney <jmg@FreeBSD.org>, freebsd-current@FreeBSD.org
Subject:   Re: top(1) stopped working on -current
Message-ID:  <20060427141318.GA74140@gothmog.pc>
In-Reply-To: <c21e92e20604262342v31c440bah7ad79a8c679fb134@mail.gmail.com>
References:  <c21e92e20604262342v31c440bah7ad79a8c679fb134@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--ikeVEW9yuYc//A+q
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On 2006-04-27 14:42, Jiawei Ye <leafy7382@gmail.com> wrote:
> leafy@chihiro:~$ top
> top: sysctl(kern.ccpu...) failed: No such file or directory
>
> -current as of 4 hrs ago.

The following change renames `kern.ccpu' to `kern.sched.ccpu', but it is
kind of incomplete, IMHO.

# Index: src/sys/kern/sched_4bsd.c
# ===================================================================
# --- src/sys/kern/sched_4bsd.c   (revision 19)
# +++ src/sys/kern/sched_4bsd.c   (working copy)
# @@ -31,11 +31,11 @@
#   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
#   * SUCH DAMAGE.
#   */
#
#  #include <sys/cdefs.h>
# -__FBSDID("$FreeBSD: src/sys/kern/sched_4bsd.c,v 1.78 2006/04/17 18:20:37 jhb Exp $");
# +__FBSDID("$FreeBSD: src/sys/kern/sched_4bsd.c,v 1.79 2006/04/26 19:42:38 jmg Exp $");
#
#  #include "opt_hwpmc_hooks.h"
#
#  #define kse td_sched
#
# @@ -404,11 +404,11 @@
#  #define        loadfactor(loadav)      (2 * (loadav))
#  #define        decay_cpu(loadfac, cpu) (((loadfac) * (cpu)) / ((loadfac) + FSCALE))
#
#  /* decay 95% of `ke_pctcpu' in 60 seconds; see CCPU_SHIFT before changing */
#  static fixpt_t ccpu = 0.95122942450071400909 * FSCALE; /* exp(-1/20) */
# -SYSCTL_INT(_kern, OID_AUTO, ccpu, CTLFLAG_RD, &ccpu, 0, "");
# +SYSCTL_INT(_kern_sched, OID_AUTO, ccpu, CTLFLAG_RD, &ccpu, 0, "");
#
#  /*
#   * If `ccpu' is not equal to `exp(-1/20)' and you still want to use the
#   * faster/more-accurate formula, you'll have to estimate CCPU_SHIFT below
#   * and possibly adjust FSHIFT in "param.h" so that (FSHIFT >= CCPU_SHIFT).

The main problems with this change are:

    1) It doesn't update consumers of the kern.ccpu sysctl that we
       already have in the tree (i.e. top(1) which you saw breaking).

    2) It doesn't update the `kern.ccpu' sysctl in the sched_ule.c
       scheduler, so it creates an inconsistency between different
       FreeBSD scheduling systems.

I believe John-Mark can fix this easily, so I've copied him in this
message.  In the mean time, you can revert sched_4bsd.c to revision 1.78
and try to see if this fixes the problems top(1) is having.

- Giorgos


--ikeVEW9yuYc//A+q
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (FreeBSD)

iD8DBQFEUNF+1g+UGjGGA7YRArU+AJ42HQFEkseJVp3+ucCabRooTtb04QCgnv1B
6TCQ4jfYZQ+Lu0VS4AtUuRI=
=s5xR
-----END PGP SIGNATURE-----

--ikeVEW9yuYc//A+q--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060427141318.GA74140>