Re: nswap

2003-01-21 Thread David Schultz
Thus spake Mark Santcroos [EMAIL PROTECTED]:
 Yes, that is also what I meant. We now have a swapoff() system call that
 does all the work itself.
 
 My idea was to split that up:
 
 /* turn of swap device */
 static int swapoff_one(struct swdevt *sp)
 {
   /* Do all things that we don't want to know about outside this function
*/
 }
 
 /* turn off all swap devices */
 int swapoff_all()
 {
   int index;
   struct swdevt *sp;
 
   for (sp = swdevt, index = 0; index  nswdev; index++, sp++)
 swapoff_one(sp);
 }
 
 So the swapoff() system call would call swapoff_one() and my code in
 kern/kern_swsuspend.c would call swapoff_all().

See swapoff(8), in particular the -a flag.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-hackers in the body of the message



Re: nswap

2003-01-21 Thread Mark Santcroos
On Tue, Jan 21, 2003 at 01:33:01AM -0800, David Schultz wrote:
 Thus spake Mark Santcroos [EMAIL PROTECTED]:
  Yes, that is also what I meant. We now have a swapoff() system call that
  does all the work itself.
  
  My idea was to split that up:
  
  /* turn of swap device */
  static int swapoff_one(struct swdevt *sp)
  {
/* Do all things that we don't want to know about outside this function
   */
  }
  
  /* turn off all swap devices */
  int swapoff_all()
  {
int index;
  struct swdevt *sp;
  
for (sp = swdevt, index = 0; index  nswdev; index++, sp++)
  swapoff_one(sp);
  }
  
  So the swapoff() system call would call swapoff_one() and my code in
  kern/kern_swsuspend.c would call swapoff_all().
 
 See swapoff(8), in particular the -a flag.

I'm aware of that, but imho it doesn't suite my purpose. Are you strongly
against having such code inside the kernel?

Mark

-- 
Mark SantcroosRIPE Network Coordination Centre
http://www.ripe.net/home/mark/New Projects Group/TTM

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-hackers in the body of the message



Re: nswap

2003-01-21 Thread David Schultz
Thus spake Mark Santcroos [EMAIL PROTECTED]:
 On Tue, Jan 21, 2003 at 01:33:01AM -0800, David Schultz wrote:
  Thus spake Mark Santcroos [EMAIL PROTECTED]:
   Yes, that is also what I meant. We now have a swapoff() system call that
   does all the work itself.
   
   My idea was to split that up:
   
   /* turn of swap device */
   static int swapoff_one(struct swdevt *sp)
   {
 /* Do all things that we don't want to know about outside this function
  */
   }
   
   /* turn off all swap devices */
   int swapoff_all()
   {
 int index;
 struct swdevt *sp;
   
 for (sp = swdevt, index = 0; index  nswdev; index++, sp++)
   swapoff_one(sp);
   }
   
   So the swapoff() system call would call swapoff_one() and my code in
   kern/kern_swsuspend.c would call swapoff_all().
  
  See swapoff(8), in particular the -a flag.
 
 I'm aware of that, but imho it doesn't suite my purpose. Are you strongly
 against having such code inside the kernel?

In that case, I'm not sure I understand what you're trying to do.
There's already a sysctl interface to get the names of all the
swap devices in the system, and from there you can call swapoff(2)
on each one.  Anyway, it doesn't really bother me to add similar
functionality to the kernel if that seems useful, but it's also
not my decision.  Perhaps if you posted patches, someone could
make more specific comments.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-hackers in the body of the message



Re: nswap

2003-01-20 Thread Mark Santcroos
On Fri, Jan 17, 2003 at 03:27:29PM -0800, David Schultz wrote:
 Thus spake Mark Santcroos [EMAIL PROTECTED]:
  in sys/systm.h:
  extern int nswap;   /* size of swap space */
  
  in vm/vm_swap.c:
  static int nswap;   /* first block after the interleaved devs */
  
  Is the extern pointing to this variable? (It seems so, don't see any other
  such variable in the three)
  If so, is there any problem with making nswap non-static?
 
 It's a constant that is only relevant to the management of the
 swap allocation bitmap, so it is properly static.  It shouldn't be
 declared in sys/systm.h.

I need to get access to the swap interface. More precisely, I want to turn
it off.

Either some of the values and functions need to be made global or the
interface should be changed.

I need this for software suspending on which I am working. (Page in processes 
and turn off swap devices before I write out the memory to it)

Is it worth my time to produce patches that change the swapoff interface?

Mark

-- 
Mark SantcroosRIPE Network Coordination Centre
http://www.ripe.net/home/mark/New Projects Group/TTM

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-hackers in the body of the message



Re: nswap

2003-01-20 Thread David Schultz
Thus spake Mark Santcroos [EMAIL PROTECTED]:
 On Fri, Jan 17, 2003 at 03:27:29PM -0800, David Schultz wrote:
  Thus spake Mark Santcroos [EMAIL PROTECTED]:
   in sys/systm.h:
   extern int nswap;   /* size of swap space */
   
   in vm/vm_swap.c:
   static int nswap;   /* first block after the interleaved devs */
   
   Is the extern pointing to this variable? (It seems so, don't see any other
   such variable in the three)
   If so, is there any problem with making nswap non-static?
  
  It's a constant that is only relevant to the management of the
  swap allocation bitmap, so it is properly static.  It shouldn't be
  declared in sys/systm.h.
 
 I need to get access to the swap interface. More precisely, I want to turn
 it off.
 
 Either some of the values and functions need to be made global or the
 interface should be changed.
 
 I need this for software suspending on which I am working. (Page in processes 
 and turn off swap devices before I write out the memory to it)
 
 Is it worth my time to produce patches that change the swapoff interface?

What exactly do you need to change about the swapoff interface?
Unless you're trying to write a module, anything that's going to
be invasive into the swap subsystem's data structures probably
belongs in vm_swap.c.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-hackers in the body of the message



Re: nswap

2003-01-17 Thread David Schultz
Thus spake Mark Santcroos [EMAIL PROTECTED]:
 in sys/systm.h:
 extern int nswap;   /* size of swap space */
 
 in vm/vm_swap.c:
 static int nswap;   /* first block after the interleaved devs */
 
 Is the extern pointing to this variable? (It seems so, don't see any other
 such variable in the three)
 If so, is there any problem with making nswap non-static?

It's a constant that is only relevant to the management of the
swap allocation bitmap, so it is properly static.  It shouldn't be
declared in sys/systm.h.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-hackers in the body of the message