Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Aug 2002 09:54:33 -0300
From:      Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.org>
To:        FreeBSD-hackers@FreeBSD.ORG
Cc:        David Schultz <dschultz@uclink.Berkeley.EDU>
Subject:   Re: Creating a sysctl? (mission impossible)
Message-ID:  <20020822125455.376.qmail@exxodus.fedaykin.here>
In-Reply-To: <20020822030842.GA22058@HAL9000.homeunix.com>
References:  <20020820180222.927.qmail@exxodus.fedaykin.here> <20020822030842.GA22058@HAL9000.homeunix.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Aug 21, 2002 at 08:08:20PM -0700, David Schultz wrote:
> Thus spake Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.ORG>:
> > 	I am trying to create one sysctl so that I can read information
> > from a lottery scheduler that I am trying to write.
> > 	The sysctl is very very simple. I add a lottery node under kern
> > then add a member global_tickets under kern.lottery. Very simple stuff
> > that is not working.
> 
> FYI, lottery scheduling has already been implemented at least
> twice for FreeBSD.  For an example, see

	I know about the other implementations. However, this is
for my graduation course. Therefore, I will be implementing it.  It
would much better if it was suitable for proper inclusion in the
kernel. Besides, since this is for my graduation course, I have
avoiding checking similar implementations to avoid design plagiarization.
Nevertheless, I might check similar implementations to get some
ideas now that I'm reaching the higher level abstractions.

[snip]

> The code has not been maintained, apparently due to a lack of
> interest, and it incurs a high scheduling overhead.  Note that the KSE

	Well, the high overhead has usually been due to the design
implementation. It is usually due to the data structure used for
holding the processes in the scheduler. Aside from that, the only
really expensive call is random(). I am trying to use least expensive
design in this code but I am aware of this possible caveat.

> work is likely to bring significant changes to scheduling in FreeBSD,
> possibly causing you headaches later.  You might also be interested in

	I know. :) But since I need this working in the next week,
I can't really risk trying -CURRENT. I'll have to port this to
-CURRENT later since I want all of Waldspurger's proportional
schedulers eventually merged into the FreeBSD distribution. Of
course, if I can convince -arch ppl that this worth it. Also, users
that desire lottery scheduler desire it most for the different
policy not exactly for less overhead though I'll try to keep the
overhead to a minimum.

> Luigi's work on a PS scheduler; check the list archives.

	I will but my current priority is getting lottery
scheduler to a working least expensive shape. I think I am going
to contact Luigi, he probably has experience with some of the
problems I am facing.

ps: by the way, for those tracking this from archives. The "solution"
for the sysctl problem is

o Problem: Although, the sysctl symbols could be found in the kernel
  through 'nm /kernel', 'sysctl -a' did not show them.
o Solution: Add header file <sys/kernel.h> which requires <sys/param.h>
o Reason: "SYSCTL_* uses the DATA_SET macro, which is in linker_set.h,
  which is included by kernel.h. If you didn't have it, DATA_SET
  was giving weird declaration warnings, but i guess since there
  was nothing in the file it didn't matter when linked" [1]

Submitted by:	ah-zeep [1]

	So a correct example for adding any sysctl has the following
template:

#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/sysctl.h>

SYSCTL_NODE(_kern, OID_AUTO, lottery, CTLFLAG_RD, 0,
"Lottery scheduling parameters");

SYSCTL_UINT(_kern_lottery, OID_AUTO, global_tickets, CTLFLAG_RD,
&global_tickets, 0, "Current global tickets");

-- 
Mario S F Ferreira - DF - Brazil - "I guess this is a signature."
Computer Science Undergraduate | FreeBSD Committer | CS Developer
flames to beloved devnull@someotherworldbeloworabove.org
feature, n: a documented bug | bug, n: an undocumented feature

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




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