From owner-freebsd-hackers@FreeBSD.ORG Thu Apr 10 14:07:31 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D9B401065671 for ; Thu, 10 Apr 2008 14:07:31 +0000 (UTC) (envelope-from z@zlo.nu) Received: from mzh.zlo.nu (ns0.zlo.nu [85.17.141.90]) by mx1.freebsd.org (Postfix) with ESMTP id A15908FC13 for ; Thu, 10 Apr 2008 14:07:31 +0000 (UTC) (envelope-from z@zlo.nu) Received: by mzh.zlo.nu (Postfix, from userid 1000) id 7932B141F4; Thu, 10 Apr 2008 15:46:59 +0200 (CEST) Date: Thu, 10 Apr 2008 15:46:59 +0200 From: Marc Olzheim To: d@delphij.net Message-ID: <20080410134659.GA11204@zlo.nu> References: <47FB8F49.6060105@gmail.com> <47FBA50B.6020801@delphij.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="huq684BweRXVnRxX" Content-Disposition: inline In-Reply-To: <47FBA50B.6020801@delphij.net> User-Agent: Mutt/1.5.13 (2006-08-11) X-Mailman-Approved-At: Thu, 10 Apr 2008 15:36:56 +0000 Cc: freebsd-hackers@freebsd.org, "Aryeh M. Friedman" Subject: Re: normal users calling setpriority(2) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Apr 2008 14:07:31 -0000 --huq684BweRXVnRxX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 08, 2008 at 10:02:03AM -0700, LI Xin wrote: > Aryeh M. Friedman wrote: > >Is it possible via sysctl or some other method to allow non-superusers= =20 > >to set any priority they want. The specific question is I often want= =20 > >to set idprio 31 on stuff but don't want to switch to root to do it (I= =20 > >am the only user on the machine). >=20 > No if nobody implement PRIV_SCHED_SETPRIORTY support for non-root. It's intentionally disabled to prevent deadlocks, see about line 330 of /usr/src/sys/kern/kern_resource.c: * Realtime priority has to be restricted for reasons which should be * obvious. However, for idle priority, there is a potential for * system deadlock if an idleprio process gains a lock on a resource * that other processes need (and the idleprio process can't run * due to a CPU-bound normal process). Fix me! XXX If you want to allow it (we've done so for years without any real trouble), simply change it to like: #if 1 if (RTP_PRIO_IS_REALTIME(rtp.type)) #else if (rtp.type !=3D RTP_PRIO_NORMAL) #endif { Marc --huq684BweRXVnRxX Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFH/hpTezjnobFOgrERAmL3AKClVIu5/D6zIPvup75SswF6I1zprwCeOsIY WTURwp8SgrKAUeFXFGbBvos= =KOza -----END PGP SIGNATURE----- --huq684BweRXVnRxX--