From owner-cvs-src@FreeBSD.ORG Fri Jun 15 12:03:07 2007 Return-Path: X-Original-To: cvs-src@FreeBSD.org Delivered-To: cvs-src@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AC85216A469; Fri, 15 Jun 2007 12:03:07 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 9EA2913C4AD; Fri, 15 Jun 2007 12:03:07 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l5FC37Tp020164; Fri, 15 Jun 2007 12:03:07 GMT (envelope-from bde@repoman.freebsd.org) Received: (from bde@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l5FC37xG020163; Fri, 15 Jun 2007 12:03:07 GMT (envelope-from bde) Message-Id: <200706151203.l5FC37xG020163@repoman.freebsd.org> From: Bruce Evans Date: Fri, 15 Jun 2007 12:03:07 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Cc: Subject: cvs commit: src/usr.bin/top machine.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2007 12:03:07 -0000 bde 2007-06-15 12:03:07 UTC FreeBSD src repository Modified files: usr.bin/top machine.c Log: Third stage of unbreaking printing of pseudo-nice values (realtime priorities, etc.) in the NICE field: Use a combination of pri_native and pri_user instead of pri_level to guess the original realtime priority. Using pri_level here has been wrong since 2001/02/12. Using only pri_native here would be correct if the kernel actually initialized it reasonably. (The kernel exports its raw td_base_priority as pri_native, but userland mostly wants a refined base priority). Give up on waiting pri_native to work correctly and only use it when there is nothing better (for kthreads). This should reduce printing of bizarre pseudo-nice values. Bizarre values are still printed if we observe a transient borrowed priority for a kthread (transient borrowing is the main thing that makes the raw td_base_priority almost useless in userland), or if there is a kernel bug. One current kernel bug involves the kernel idprio thread pagezero permanently changing its priority from PRI_MAX_IDLE (255) to PUSER (160). Then the bizarre value "ki-6" is printed instead of "ki31". Here "-6" is PRI_MIN_IDLE - PUSER = -64 truncated to 2 characters. We are observing a transient borrowed priority that has become permanent due to a bug. ps/print.c:priorityr() needs similar changes (including ones in stage 2 here). Revision Changes Path 1.81 +25 -2 src/usr.bin/top/machine.c