Calling sys_sysinfo from sched.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I want to use larger time slices when the ram starts to get full to try to
reduce the time spent swapping the pages in and out.  I added the following to
the scheduler in linux 2.6.9 and I can't figure out
why it's not working.  There were two different sysinfo() functions I found and
this is what I think is confusing me.  The site
http://linux.about.com/library/cmd/blcmdl2_intro.htm says it's a system call
and requires me to add stuff like:
static int errno;
_syscall1(int, sysinfo, struct sysinfo *, info);
I think that version of it is used from programs other that the kernel so none
the examples of it that I found show how it would be used from inside the
kernel.  The second version, I found in a source navigator
http://lxr.linux.no/source/kernel/timer.c?v=2.6.10#L1234 and is saying it
should work a different way.
Another thing is I'm struggling to figure out what's wrong when it crashes
during booting.  When it does give me any info it's all just about the
registers and the stack and I can't make any sense of it.

#include <linux/syscalls.h>

#define MIN_TIMESLICE                scaleSlices * max(5 * HZ / 1000, 1)
#define DEF_TIMESLICE                scaleSlices * (100 * HZ / 1000)

int scaleSlices = 1;

/* There were two functions for filling in a sysinfo structure.  This was
apparantly needed for the one I tried first.  I don't know if sys_sysinfo needs
it.*/
static int errno;
_syscall1(int, sysinfo, struct sysinfo *, info);

struct sysinfo s_info;

/* Flag for large time slices.
 * So that the swap_tuner() doesn't keep enlarging the time slices
 */
static int largerTSs = 0;

/* This is in the middle of a function I added further down.  The function is
called right at the start of schedule() but this is the only line that makes it
crash.  It caused an opps the first time I tried to boot it and then it started
looping some message repeatively last time. */
sys_sysinfo(&s_info);



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux