Re: How does swap work address spacewise?

2002-07-06 Thread Matthew Dillon


:If RAM + swap can be more than 4GB, how does FreeBSD address swap on a
:32-bit machine?  Does the kernel internally use a wider address space
:with some kind of translation to 32-bit space for programs and hardware
:that can't handle 64-bit addresses or does it not map swap into the
:address space at all, instead using it as a kind of offline storage
:for pages not in use?  Does the Alpha port handle swap the same way?
:

The 4GB limitation only applies to memory addresses.  Block devices 
and files have no such limitation ... 'off_t' has been 64 bits for many
years.  You can create filesystems and files up to 2TB in size in -stable
and it will be virtually unlimited in -current.

-Matt
Matthew Dillon 
[EMAIL PROTECTED]


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



Re: How does swap work address spacewise?

2002-07-06 Thread Darren Pilgrim

Bernd Walter wrote:
 On Fri, Jul 05, 2002 at 05:58:15PM -0700, Darren Pilgrim wrote:
  If RAM + swap can be more than 4GB, how does FreeBSD address swap on a
  32-bit machine?  Does the kernel internally use a wider address space
 
 The same way it does on every partitition: using block numbers.
 That way you can address 1TByte.

I thought the limit for filesystems was 2TB?

 And you can have more than a single swap partition.

Up to four, so then the theoretical limit for swap is 8TB?

 In reality managementstructures which have to be in kernel addressspace
 is limiting swap before.

Do these management structures grow as swap grows, or do they only
change as the utilization increases?

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



Re: How does swap work address spacewise?

2002-07-06 Thread Matthew D. Fuller

On Sat, Jul 06, 2002 at 02:37:02PM -0700 I heard the voice of
Darren Pilgrim, and lo! it spake thus:
 
  And you can have more than a single swap partition.
 
 Up to four, so then the theoretical limit for swap is 8TB?

I hope not, since I have 6 of 'em.  4's just the default.


 Do these management structures grow as swap grows, or do they only
 change as the utilization increases?

I believe they're pre-allocated, so it's the size of swap configured (not
used) that eats it.


-- 
Matthew Fuller (MF4839)   |  [EMAIL PROTECTED]
Systems/Network Administrator |  http://www.over-yonder.net/~fullermd/

The only reason I'm burning my candle at both ends, is because I
  haven't figured out how to light the middle yet

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



Re: How does swap work address spacewise?

2002-07-06 Thread Bernd Walter

On Sat, Jul 06, 2002 at 02:37:02PM -0700, Darren Pilgrim wrote:
 Bernd Walter wrote:
  On Fri, Jul 05, 2002 at 05:58:15PM -0700, Darren Pilgrim wrote:
   If RAM + swap can be more than 4GB, how does FreeBSD address swap on a
   32-bit machine?  Does the kernel internally use a wider address space
  
  The same way it does on every partitition: using block numbers.
  That way you can address 1TByte.
 
 I thought the limit for filesystems was 2TB?

The Blocknumber is signed that gives:
2^31 * 512Bytes

  And you can have more than a single swap partition.
 
 Up to four, so then the theoretical limit for swap is 8TB?

4 is just a default.
[61]cicely9# swapinfo
Device  1K-blocks UsedAvail Capacity  Type
/dev/da1b  105472   80   105392 0%Interleaved
/dev/da11b 1748800   174880 0%Interleaved
/dev/da4b  2114560   211456 0%Interleaved
/dev/da5b  2114560   211456 0%Interleaved
/dev/da6b  2114560   211456 0%Interleaved
/dev/da7b  2114560   211456 0%Interleaved
/dev/da8b  2114560   211456 0%Interleaved
/dev/da9b  2114560   211456 0%Interleaved
/dev/da10b 2114560   211456 0%Interleaved
Total 1760544   80  1760464 0%

The limit here is the maximum number of harddisks, which is IIRC 512
per driver.
This cames from the available minor bits in the device node.

  In reality managementstructures which have to be in kernel addressspace
  is limiting swap before.
 
 Do these management structures grow as swap grows, or do they only
 change as the utilization increases?

AFAIK there is a static part.
Possible not memory but only KVM addressspace.
Also AFAIK it makes a difference if you allocate the same space
using a single partition or in more than one.

-- 
B.Walter  COSMO-Project http://www.cosmo-project.de
[EMAIL PROTECTED] Usergroup   [EMAIL PROTECTED]


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



Re: How does swap work address spacewise?

2002-07-06 Thread Darren Pilgrim

Bernd Walter wrote:
 On Sat, Jul 06, 2002 at 02:37:02PM -0700, Darren Pilgrim wrote:
  Bernd Walter wrote:
   On Fri, Jul 05, 2002 at 05:58:15PM -0700, Darren Pilgrim wrote:
If RAM + swap can be more than 4GB, how does FreeBSD address swap on a
32-bit machine?  Does the kernel internally use a wider address space
  
   The same way it does on every partitition: using block numbers.
   That way you can address 1TByte.
 
  I thought the limit for filesystems was 2TB?
 
 The Blocknumber is signed that gives:
 2^31 * 512Bytes

Why sign the blocknumber?  LBA uses an unsigned 32-bit integer,
allowing 2TB, and IIRC SCSI uses an unsigned integer as well (though I
can't remember if that one is 32 or 48 bits, or if they've gotten to
64 bits by now).

   And you can have more than a single swap partition.
 
  Up to four, so then the theoretical limit for swap is 8TB?
 
 4 is just a default.
 The limit here is the maximum number of harddisks, which is IIRC 512
 per driver.
 This cames from the available minor bits in the device node.

That makes sense, how do you get past the default of four?  Is there a
tweak to be made, or do you just swapon as usual?

   In reality managementstructures which have to be in kernel addressspace
   is limiting swap before.
 
  Do these management structures grow as swap grows, or do they only
  change as the utilization increases?
 
 AFAIK there is a static part.
 Possible not memory but only KVM addressspace.
 Also AFAIK it makes a difference if you allocate the same space
 using a single partition or in more than one.

Understandable, with more than one, the kernel then has to do what
amounts to software RAID on the swap partitions.

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



Re: How does swap work address spacewise?

2002-07-06 Thread Terry Lambert

Darren Pilgrim wrote:
   I thought the limit for filesystems was 2TB?
 
  The Blocknumber is signed that gives:
  2^31 * 512Bytes
 
 Why sign the blocknumber?  LBA uses an unsigned 32-bit integer,
 allowing 2TB, and IIRC SCSI uses an unsigned integer as well (though I
 can't remember if that one is 32 or 48 bits, or if they've gotten to
 64 bits by now).

To differentiate between direct (positive) and indirect (negative)
blocks within the inode, and within an indirect block.

-- Terry

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



Re: How does swap work address spacewise?

2002-07-06 Thread Bernd Walter

On Sat, Jul 06, 2002 at 03:43:00PM -0700, Darren Pilgrim wrote:
 Bernd Walter wrote:
  On Sat, Jul 06, 2002 at 02:37:02PM -0700, Darren Pilgrim wrote:
   Bernd Walter wrote:
On Fri, Jul 05, 2002 at 05:58:15PM -0700, Darren Pilgrim wrote:
 If RAM + swap can be more than 4GB, how does FreeBSD address swap on a
 32-bit machine?  Does the kernel internally use a wider address space
   
The same way it does on every partitition: using block numbers.
That way you can address 1TByte.
  
   I thought the limit for filesystems was 2TB?
  
  The Blocknumber is signed that gives:
  2^31 * 512Bytes
 
 Why sign the blocknumber?  LBA uses an unsigned 32-bit integer,

Because negative numbers are used internaly to handle errors.
It's already 64 bit in -current so no need to worry about the future.

 allowing 2TB, and IIRC SCSI uses an unsigned integer as well (though I
 can't remember if that one is 32 or 48 bits, or if they've gotten to
 64 bits by now).

SCSI1+2 has 24 and 32 bit unsigned.
SCSI3 has defined wider commands - IIRC it was 48bit.

And you can have more than a single swap partition.
  
   Up to four, so then the theoretical limit for swap is 8TB?
  
  4 is just a default.
  The limit here is the maximum number of harddisks, which is IIRC 512
  per driver.
  This cames from the available minor bits in the device node.
 
 That makes sense, how do you get past the default of four?  Is there a
 tweak to be made, or do you just swapon as usual?

options NSWAPDEV=5
in kernelconfig.

In reality managementstructures which have to be in kernel addressspace
is limiting swap before.
  
   Do these management structures grow as swap grows, or do they only
   change as the utilization increases?
  
  AFAIK there is a static part.
  Possible not memory but only KVM addressspace.
  Also AFAIK it makes a difference if you allocate the same space
  using a single partition or in more than one.
 
 Understandable, with more than one, the kernel then has to do what
 amounts to software RAID on the swap partitions.

The swappager balances itself, which is different to RAID.
E.g. it can avoid spreading an object over disks.
IIRC the needed kernel space is even less if your swap is on more
disks.

-- 
B.Walter  COSMO-Project http://www.cosmo-project.de
[EMAIL PROTECTED] Usergroup   [EMAIL PROTECTED]


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



Re: How does swap work address spacewise?

2002-07-06 Thread Bernd Walter

On Sat, Jul 06, 2002 at 04:01:18PM -0700, Terry Lambert wrote:
 Darren Pilgrim wrote:
I thought the limit for filesystems was 2TB?
  
   The Blocknumber is signed that gives:
   2^31 * 512Bytes
  
  Why sign the blocknumber?  LBA uses an unsigned 32-bit integer,
  allowing 2TB, and IIRC SCSI uses an unsigned integer as well (though I
  can't remember if that one is 32 or 48 bits, or if they've gotten to
  64 bits by now).
 
 To differentiate between direct (positive) and indirect (negative)
 blocks within the inode, and within an indirect block.

Inodes hold fs blocks which are different from device blocks.
On UFS they are sized equaly to fragments.
And I never saw negative blocknumbers in inodes or indirect blocks.
The difference is made just with the location of the entry.
Do you have a special filesystem in mind?

-- 
B.Walter  COSMO-Project http://www.cosmo-project.de
[EMAIL PROTECTED] Usergroup   [EMAIL PROTECTED]


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



Re: How does swap work address spacewise?

2002-07-06 Thread Matthew Dillon


:...
: 
: Up to four, so then the theoretical limit for swap is 8TB?
:
:I hope not, since I have 6 of 'em.  4's just the default.
:
:
: Do these management structures grow as swap grows, or do they only
: change as the utilization increases?
:
:I believe they're pre-allocated, so it's the size of swap configured (not
:used) that eats it.
:
:-- 
:Matthew Fuller (MF4839)   |  [EMAIL PROTECTED]

The nominal limit for swap space is around 14 GB due to limitations
in available KVM.  There are three major limiting factors in the kernel:

* The swap bitmap eats 2 bits per page of swap.  The bitmap is sized
  to handle NSWAP (default 4) x size_of_largest_swap_partition.

* The system has to keep track of pages that are swapped out.
  The system reserves 8 x physical_pages_in_system worth of
  KVM to keep track of swapped out pages.  A machine with 4G
  of ram reserves enough KVA to hold 32GB worth of swapped out pages.

* The system limits the size of the above zone to VM_SWZONE_SIZE_MAX,
  which is typically around 70 MB of KVM (enough to hold 14 GB worth
  of swap mappings).

So the nominal limit is around 14 GB on a 32 bit architecture.  With
tuning this limit can be bumped up, but the practical limit is
going to be around 60GB unless you give the kernel more KVA (reducing
the amount of VM a user process can access).

On 64 bit architectures the only real limitation is how much physical
memory one is willing to burn to hold active swap mappings.

And, no, there are no plans to swap out the swap mappings themselves...
that would be a complete waste of effort.

-Matt


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



Re: How does swap work address spacewise?

2002-07-06 Thread Matthew Dillon

Negative block numbers are used by UFS to represent the indirect blocks
associated with a file, while positive block numbers represent the
contents of the file.

These are logical block numbers, which are fragment-sized (1K typically).
So, 2^31 x 1K = 2TB.

Physical block numbers are 512-byte sized, with a range of 2^32
in -stable.  This also winds up being 2TB.  So increasing the fragment
size does not help in -stable.

In -current physical block numbers are now 64 bits, removing the 2TB
limit, and UFS2 uses 64 bit block numbers, removing the filesystem-imposed
2TB limit.  I'm not sure how much more work there is to go in this
area, you could ask Poul or Kirk.

-Matt


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



Re: How does swap work address spacewise?

2002-07-06 Thread Bernd Walter

On Sat, Jul 06, 2002 at 04:42:22PM -0700, Matthew Dillon wrote:
 Negative block numbers are used by UFS to represent the indirect blocks
 associated with a file, while positive block numbers represent the
 contents of the file.

I never saw any negative block numbers in on-disc structures.
Now I wonder if it was just hidden behind macros.
What is the reason to handle it that way?
Do you have some code reference for homework?

 These are logical block numbers, which are fragment-sized (1K typically).
 So, 2^31 x 1K = 2TB.
 
 Physical block numbers are 512-byte sized, with a range of 2^32
 in -stable.  This also winds up being 2TB.  So increasing the fragment
 size does not help in -stable.

It's a proven fact that there is a 1T limit somewhere which was
explained with physical block numbers beeing signed.

-- 
B.Walter  COSMO-Project http://www.cosmo-project.de
[EMAIL PROTECTED] Usergroup   [EMAIL PROTECTED]


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



Re: How does swap work address spacewise?

2002-07-06 Thread Matthew Dillon


:
:On Sat, Jul 06, 2002 at 04:42:22PM -0700, Matthew Dillon wrote:
: Negative block numbers are used by UFS to represent the indirect blocks
: associated with a file, while positive block numbers represent the
: contents of the file.
:
:I never saw any negative block numbers in on-disc structures.
:Now I wonder if it was just hidden behind macros.
:What is the reason to handle it that way?
:Do you have some code reference for homework?

LOGICAL block numbers, not physical block numbers.

: These are logical block numbers, which are fragment-sized (1K typically).
: So, 2^31 x 1K = 2TB.
: 
: Physical block numbers are 512-byte sized, with a range of 2^32
: in -stable.  This also winds up being 2TB.  So increasing the fragment
: size does not help in -stable.
:
:It's a proven fact that there is a 1T limit somewhere which was
:explained with physical block numbers beeing signed.
:
:-- 
:B.Walter  COSMO-Project http://www.cosmo-project.de

test1# vnconfig -e -s labels -r reserve -S 2t vn0
test1# disklabel -r -w vn0 auto
test1# disklabel vn0
...
bytes/sector: 4096
...
8 partitions:
#size   offsetfstype   [fsize bsize bps/cpg]
  c: 5368709120unused0 0# (Cyl.0 - 2097151)

Theoretically VN can create up to an 8TB virtual disk because the
sector size for a swap-backed VN device is 4K, but I'm not sure I
would want to test the theory.


With a regular file:

test1# vnconfig -e -s labels -T -S 2047g vn0 test.dat
test1# disklabel -r -w vn0 auto
test1# disklabel vn0
...
bytes/sector: 512
...
  c: 42928701440unused0 0   # (Cyl.0 - 2

test1# ls -la test.dat
-rw---xr--  1 root  wheel  219902322 Jul  7 00:31 test.dat
test1# 

(of course, god help you if you tried to 'newfs' the above!)

-Matt
Matthew Dillon 
[EMAIL PROTECTED]


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



Re: How does swap work address spacewise?

2002-07-06 Thread Bernd Walter

On Sun, Jul 07, 2002 at 02:10:19AM +0200, Bernd Walter wrote:
 On Sat, Jul 06, 2002 at 04:42:22PM -0700, Matthew Dillon wrote:
  Negative block numbers are used by UFS to represent the indirect blocks
  associated with a file, while positive block numbers represent the
  contents of the file.
 
 I never saw any negative block numbers in on-disc structures.
 Now I wonder if it was just hidden behind macros.
 What is the reason to handle it that way?
 Do you have some code reference for homework?

OK - I've found it used for incore data and understand why it's done.

  These are logical block numbers, which are fragment-sized (1K typically).
  So, 2^31 x 1K = 2TB.
  
  Physical block numbers are 512-byte sized, with a range of 2^32
  in -stable.  This also winds up being 2TB.  So increasing the fragment
  size does not help in -stable.
 
 It's a proven fact that there is a 1T limit somewhere which was
 explained with physical block numbers beeing signed.

-- 
B.Walter  COSMO-Project http://www.cosmo-project.de
[EMAIL PROTECTED] Usergroup   [EMAIL PROTECTED]


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



Re: How does swap work address spacewise?

2002-07-06 Thread Matthew Dillon

:  
:  Physical block numbers are 512-byte sized, with a range of 2^32
:  in -stable.  This also winds up being 2TB.  So increasing the fragment
:  size does not help in -stable.
: 
: It's a proven fact that there is a 1T limit somewhere which was
: explained with physical block numbers beeing signed.
:
:-- 
:B.Walter  COSMO-Project http://www.cosmo-project.de

   fsck and newfs would be unhappy with a 2TB sized filesystem (in stable),
   at least one with 512 byte sectors, due to internal math overflows but
   I think that's the only 1TB vs 2TB issue.

-Matt
Matthew Dillon 
[EMAIL PROTECTED]

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



Re: How does swap work address spacewise?

2002-07-06 Thread Ian Dowse

In message [EMAIL PROTECTED], Bernd Walter writes:
I never saw any negative block numbers in on-disc structures.
Now I wonder if it was just hidden behind macros.
What is the reason to handle it that way?
Do you have some code reference for homework?

These logical block numbers are not stored on disk; they are just
used by the filesystem code to refer to block numbers within a file
relative to the start of the file. The on-disk format uses direct
and indirect block pointers to refer to the actual filesystem blocks,
and it is easy to get from a lbn to the sequence of indirection
blocks necessary to find the on-disk data. See ufs_getlbns() in
sys/ufs/ufs/ufs_bmap.c for details.

 These are logical block numbers, which are fragment-sized (1K typically)

(lbns are actually in block-sized, not fragment-sized units, since
a single file block is always contiguous on the disk even if it
does not begin on a disk block boundary or is not a full block in
size. Physical UFS block numbers (ufs_daddr_t in the code) are in
fragment-sized units.)

 Physical block numbers are 512-byte sized, with a range of 2^32
 in -stable.  This also winds up being 2TB.  So increasing the fragment
 size does not help in -stable.
It's a proven fact that there is a 1T limit somewhere which was
explained with physical block numbers beeing signed.

Yes, the daddr_t type is signed, so the real limit for filesystems is
1TB I think.

Ian

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



Re: How does swap work address spacewise?

2002-07-06 Thread Bernd Walter

On Sat, Jul 06, 2002 at 05:33:50PM -0700, Matthew Dillon wrote:
 
 :
 :On Sat, Jul 06, 2002 at 04:42:22PM -0700, Matthew Dillon wrote:
 : Negative block numbers are used by UFS to represent the indirect blocks
 : associated with a file, while positive block numbers represent the
 : contents of the file.
 :
 :I never saw any negative block numbers in on-disc structures.
 :Now I wonder if it was just hidden behind macros.
 :What is the reason to handle it that way?
 :Do you have some code reference for homework?
 
 LOGICAL block numbers, not physical block numbers.

ufs on disc structures are using logical block numbers.
But well I've already found what you mean.

 : These are logical block numbers, which are fragment-sized (1K typically).
 : So, 2^31 x 1K = 2TB.
 : 
 : Physical block numbers are 512-byte sized, with a range of 2^32
 : in -stable.  This also winds up being 2TB.  So increasing the fragment
 : size does not help in -stable.
 :
 :It's a proven fact that there is a 1T limit somewhere which was
 :explained with physical block numbers beeing signed.
 
 test1# vnconfig -e -s labels -r reserve -S 2t vn0
 test1# disklabel -r -w vn0 auto
 test1# disklabel vn0
 ...
 bytes/sector: 4096
 ...
 8 partitions:
 #size   offsetfstype   [fsize bsize bps/cpg]
   c: 5368709120unused0 0# (Cyl.0 - 2097151)
 
 Theoretically VN can create up to an 8TB virtual disk because the
 sector size for a swap-backed VN device is 4K, but I'm not sure I
 would want to test the theory.
 
 
 With a regular file:
 
 test1# vnconfig -e -s labels -T -S 2047g vn0 test.dat
 test1# disklabel -r -w vn0 auto
 test1# disklabel vn0
 ...
 bytes/sector: 512
 ...
   c: 42928701440unused0 0   # (Cyl.0 - 2
 
 test1# ls -la test.dat
 -rw---xr--  1 root  wheel  219902322 Jul  7 00:31 test.dat
 test1# 
 
 (of course, god help you if you tried to 'newfs' the above!)

But that's the important point.
You can happily create vinum 2T volumes but you can never newfs them,
because daddr_t, which is used in struct buf, is signed.
This case was tested using real disks.

OK you can format a disk using 1k sectors.
But I was told that vm internaly always adapts to 512 byte blocks
using signed 32bit varables so it wouldn't help.

-- 
B.Walter  COSMO-Project http://www.cosmo-project.de
[EMAIL PROTECTED] Usergroup   [EMAIL PROTECTED]


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



Re: How does swap work address spacewise?

2002-07-06 Thread Darren Pilgrim

Matthew Dillon wrote:
 The nominal limit for swap space is around 14 GB due to limitations
 in available KVM.  There are three major limiting factors in the kernel:
 
 * The swap bitmap eats 2 bits per page of swap.  The bitmap is sized
   to handle NSWAP (default 4) x size_of_largest_swap_partition.

Is NSWAP tied to the NSWAPDEV kernel option, or is it the actual number
of active swap devices?  If the prior, is setting NSWAPDEV to the
actual number of swap devices a useful for improving memory usage?  Is
NSWAPDEV just a compile-time tunable, or is there a sysctl to do the
same thing?

 * The system has to keep track of pages that are swapped out.
   The system reserves 8 x physical_pages_in_system worth of
   KVM to keep track of swapped out pages.  A machine with 4G
   of ram reserves enough KVA to hold 32GB worth of swapped out pages.
 
 * The system limits the size of the above zone to VM_SWZONE_SIZE_MAX,
   which is typically around 70 MB of KVM (enough to hold 14 GB worth
   of swap mappings).
 
 So the nominal limit is around 14 GB on a 32 bit architecture.  With
 tuning this limit can be bumped up, but the practical limit is
 going to be around 60GB unless you give the kernel more KVA (reducing
 the amount of VM a user process can access).

Can VM_SWZONE_SIZE_MAX be tuned down as well, or does the kernel 
already handle this efficiently enough to keep it at a minimum useful
value sized relative to PHYS?

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



Re: How does swap work address spacewise?

2002-07-06 Thread Matthew Dillon


:Is NSWAP tied to the NSWAPDEV kernel option, or is it the actual number
:of active swap devices?  If the prior, is setting NSWAPDEV to the
:actual number of swap devices a useful for improving memory usage?  Is
:NSWAPDEV just a compile-time tunable, or is there a sysctl to do the
:same thing?

Sorry, I meant NSWAPDEV there.

: So the nominal limit is around 14 GB on a 32 bit architecture.  With
: tuning this limit can be bumped up, but the practical limit is
: going to be around 60GB unless you give the kernel more KVA (reducing
: the amount of VM a user process can access).
:
:Can VM_SWZONE_SIZE_MAX be tuned down as well, or does the kernel 
:already handle this efficiently enough to keep it at a minimum useful
:value sized relative to PHYS?

The kernel handles this fairly well now.  It didn't used to.  The limit
exists to prevent the kernel from reserving absurd amounts of KVM for
swblock's on systems with lots of memory (like 2G or 4G of ram).  The
amount of KVM reserved for systems with less physical ram is fairly
small and you don't have to worry about it.  Also, this is just KVM.
Real ram is only allocated for swblock structures when you actually
start paging to swap (the bitmaps are preallocated but the space for
the swblock structures is not).

The only time you would need to tune these parameters would be if you
really needed to configure more then around 14GB of swap and have it
all be useable by the system.

-Matt
Matthew Dillon 
[EMAIL PROTECTED]

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



Re: How does swap work address spacewise?

2002-07-06 Thread Darren Pilgrim

Thanks guys, for explaining the swap system to me.  I have a good
understanding of how the system works now.  I want to particularly
thank Matthew Dillon for taking the time to lay down the technical
details as he did.  Being able to ask a question like this and get it
answered so well is what puts FreeBSD so far above other OSes in
my book.

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



How does swap work address spacewise?

2002-07-05 Thread Darren Pilgrim

If RAM + swap can be more than 4GB, how does FreeBSD address swap on a
32-bit machine?  Does the kernel internally use a wider address space
with some kind of translation to 32-bit space for programs and hardware
that can't handle 64-bit addresses or does it not map swap into the
address space at all, instead using it as a kind of offline storage
for pages not in use?  Does the Alpha port handle swap the same way?

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



Re: How does swap work address spacewise?

2002-07-05 Thread Bernd Walter

On Fri, Jul 05, 2002 at 05:58:15PM -0700, Darren Pilgrim wrote:
 If RAM + swap can be more than 4GB, how does FreeBSD address swap on a
 32-bit machine?  Does the kernel internally use a wider address space

The same way it does on every partitition: using block numbers.
That way you can address 1TByte.
And you can have more than a single swap partition.
In reality managementstructures which have to be in kernel addressspace
is limiting swap before.

 with some kind of translation to 32-bit space for programs and hardware

Don't mix address space with ram and swap.
While you can have more than 4G swap you can't have more than 4G
addressspace.
But you can have multiple different 4G addressspaces - each process
with its own.

 that can't handle 64-bit addresses or does it not map swap into the

swap is logicaly mapped into address space, but not more than 4G
in a single one.

 address space at all, instead using it as a kind of offline storage
 for pages not in use?  Does the Alpha port handle swap the same way?

Yes - I see no reason to do it different.

-- 
B.Walter  COSMO-Project http://www.cosmo-project.de
[EMAIL PROTECTED] Usergroup   [EMAIL PROTECTED]


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



Re: How does swap work address spacewise?

2002-07-05 Thread Terry Lambert

Darren Pilgrim wrote:
 If RAM + swap can be more than 4GB, how does FreeBSD address swap on a
 32-bit machine?  Does the kernel internally use a wider address space
 with some kind of translation to 32-bit space for programs and hardware
 that can't handle 64-bit addresses or does it not map swap into the
 address space at all, instead using it as a kind of offline storage
 for pages not in use?  Does the Alpha port handle swap the same way?

KVA + UVA = 4G

KVA is per system... but UVA is per process.  Therefore you can have
as much as you want, so long as it's per process, and you only run
processes one at a time (which is what kernels do ;^)).

-- Terry

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