FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Development

 
 
LinkBack Thread Tools
 
Old 05-08-2012, 10:32 AM
Vratislav Podzimek
 
Default Change swap suggestions to the chart proposed in the discussion

There was quite a long discussion [1] about swap size suggestions and
this algorithm is the result. Moreover we should use 'swap --hibernation'
instead of 'swap --same-as-ram'.

[1] https://home.corp.redhat.com/wiki/swap-size-recommendations

Resolves: rhbz#744129
Resolves: rhbz#815557
---
installclass.py | 2 +-
iutil.py | 43 +++++++++++++++++++------------------------
kickstart.py | 4 ++--
3 files changed, 22 insertions(+), 27 deletions(-)

diff --git a/installclass.py b/installclass.py
index 9514097..a417762 100644
--- a/installclass.py
+++ b/installclass.py
@@ -191,7 +191,7 @@ class BaseInstallClass(object):
if bootreq:
autorequests.extend(bootreq)

- (minswap, maxswap) = iutil.swapSameAsRam()
+ (minswap, maxswap) = iutil.swapSuggestion()
autorequests.append(PartSpec(fstype="swap", size=minswap, maxSize=maxswap,
grow=True, asVol=True))

diff --git a/iutil.py b/iutil.py
index f7254e2..d14117c 100644
--- a/iutil.py
+++ b/iutil.py
@@ -452,47 +452,42 @@ def swapSuggestion(quiet=0):
mem = ((mem/16)+1)*16
if not quiet:
log.info("Detected %sM of memory", mem)
-
- #table suggested in rhbz#744129
- if mem <= 4096:
- minswap = 2048
- maxswap = 2048

- elif 4096 < mem <= 16384:
- minswap = 4096
- maxswap = 4096
+ #chart suggested in the discussion with other teams
+ #see: https://home.corp.redhat.com/wiki/swap-size-recommendations
+ if mem < 2048:
+ minswap = 2 * mem
+ maxswap = 2 * mem

- elif 16384 < mem <= 65536:
- minswap = 8192
- maxswap = 8192
+ elif 2048 <= mem < 8192:
+ minswap = mem
+ maxswap = mem

- elif 65536 < mem <= 262144:
- minswap = 16384
- maxswap = 16384
+ elif 8192 <= mem < 65536:
+ minswap = mem / 2
+ maxswap = mem / 2

else:
- minswap = 32768
- maxswap = 32768
+ minswap = 4096
+ maxswap = 4096

if not quiet:
log.info("Swap attempt of %sM to %sM", minswap, maxswap)

return (minswap, maxswap)

-def swapSameAsRam(quiet=0):
+def swapHibernation(quiet=0):
mem = memInstalled() / 1024
mem = ((mem / 16) + 1) * 16
if not quiet:
log.info("Detected %sM of memory", mem)

- #see #rhbz587152
- if mem <= SWAP_SIZE_LIMIT:
- log.info("Swap attempt of %sM to %sM", mem, mem)
- return (mem, mem)
+ if mem <= 65536:
+ swap = mem + swapSuggestion
else:
- log.warning("Cannot create swap of size %sM, using upper bound %sM",
- mem, SWAP_SIZE_LIMIT)
- return (SWAP_SIZE_LIMIT, SWAP_SIZE_LIMIT)
+ swap = 0
+
+ return (swap, swap)

## Create a directory path. Don't fail if the directory already exists.
# @param dir The directory path to create.
diff --git a/kickstart.py b/kickstart.py
index c28f030..03ab235 100644
--- a/kickstart.py
+++ b/kickstart.py
@@ -743,8 +743,8 @@ class PartitionData(commands.partition.RHEL6_PartData):
(self.size, self.maxSizeMB) = iutil.swapSuggestion()
self.grow = True

- if self.sameAsRam:
- (self.size, self.maxSizeMB) = iutil.swapSameAsRam()
+ if self.hibernation:
+ (self.size, self.maxSizeMB) = iutil.swapHibernation()
self.grow = False
# if people want to specify no mountpoint for some reason, let them
# this is really needed for pSeries boot partitions
--
1.7.4.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 05-08-2012, 02:56 PM
Vratislav Podzimek
 
Default Change swap suggestions to the chart proposed in the discussion

There was quite a long discussion [1] about swap size suggestions and
this algorithm is the result. Moreover we should use 'swap --hibernation'
instead of 'swap --same-as-ram'.

[1] https://home.corp.redhat.com/wiki/swap-size-recommendations

Resolves: rhbz#744129
Resolves: rhbz#815557
---
installclass.py | 2 +-
iutil.py | 48 +++++++++++++++---------------------------------
kickstart.py | 4 ++--
3 files changed, 18 insertions(+), 36 deletions(-)

diff --git a/installclass.py b/installclass.py
index 9514097..a417762 100644
--- a/installclass.py
+++ b/installclass.py
@@ -191,7 +191,7 @@ class BaseInstallClass(object):
if bootreq:
autorequests.extend(bootreq)

- (minswap, maxswap) = iutil.swapSameAsRam()
+ (minswap, maxswap) = iutil.swapSuggestion()
autorequests.append(PartSpec(fstype="swap", size=minswap, maxSize=maxswap,
grow=True, asVol=True))

diff --git a/iutil.py b/iutil.py
index f7254e2..c583fe2 100644
--- a/iutil.py
+++ b/iutil.py
@@ -447,52 +447,34 @@ def memInstalled():
## Suggest the size of the swap partition that will be created.
# @param quiet Should size information be logged?
# @return A tuple of the minimum and maximum swap size, in megabytes.
-def swapSuggestion(quiet=0):
+def swapSuggestion(quiet=0, hibernation=False):
mem = memInstalled()/1024
mem = ((mem/16)+1)*16
if not quiet:
log.info("Detected %sM of memory", mem)
-
- #table suggested in rhbz#744129
- if mem <= 4096:
- minswap = 2048
- maxswap = 2048

- elif 4096 < mem <= 16384:
- minswap = 4096
- maxswap = 4096
+ #chart suggested in the discussion with other teams
+ #see: https://home.corp.redhat.com/wiki/swap-size-recommendations
+ if mem < 2048:
+ swap = 2 * mem

- elif 16384 < mem <= 65536:
- minswap = 8192
- maxswap = 8192
+ elif 2048 <= mem < 8192:
+ swap = mem

- elif 65536 < mem <= 262144:
- minswap = 16384
- maxswap = 16384
+ elif 8192 <= mem < 65536:
+ swap = mem / 2

else:
- minswap = 32768
- maxswap = 32768
+ swap = 4096

if not quiet:
- log.info("Swap attempt of %sM to %sM", minswap, maxswap)
+ log.info("Swap attempt of %sM", swap)

- return (minswap, maxswap)
+ if hibernation and mem <= 65536:
+ swap = mem + swap

-def swapSameAsRam(quiet=0):
- mem = memInstalled() / 1024
- mem = ((mem / 16) + 1) * 16
- if not quiet:
- log.info("Detected %sM of memory", mem)
-
- #see #rhbz587152
- if mem <= SWAP_SIZE_LIMIT:
- log.info("Swap attempt of %sM to %sM", mem, mem)
- return (mem, mem)
- else:
- log.warning("Cannot create swap of size %sM, using upper bound %sM",
- mem, SWAP_SIZE_LIMIT)
- return (SWAP_SIZE_LIMIT, SWAP_SIZE_LIMIT)
+ #we have to return minimum and maximum swap size
+ return (swap, swap)

## Create a directory path. Don't fail if the directory already exists.
# @param dir The directory path to create.
diff --git a/kickstart.py b/kickstart.py
index c28f030..9f56019 100644
--- a/kickstart.py
+++ b/kickstart.py
@@ -743,8 +743,8 @@ class PartitionData(commands.partition.RHEL6_PartData):
(self.size, self.maxSizeMB) = iutil.swapSuggestion()
self.grow = True

- if self.sameAsRam:
- (self.size, self.maxSizeMB) = iutil.swapSameAsRam()
+ if self.hibernation:
+ (self.size, self.maxSizeMB) = iutil.swapSuggestion(hibernation=True)
self.grow = False
# if people want to specify no mountpoint for some reason, let them
# this is really needed for pSeries boot partitions
--
1.7.4.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 05-08-2012, 03:30 PM
Vratislav Podzimek
 
Default Change swap suggestions to the chart proposed in the discussion

There was quite a long discussion [1] about swap size suggestions and
this algorithm is the result. Moreover we should use 'swap --hibernation'
instead of 'swap --same-as-ram'.

[1] https://home.corp.redhat.com/wiki/swap-size-recommendations

Resolves: rhbz#744129
Resolves: rhbz#815557
---
installclass.py | 2 +-
iutil.py | 48 +++++++++++++++---------------------------------
kickstart.py | 7 ++-----
3 files changed, 18 insertions(+), 39 deletions(-)

diff --git a/installclass.py b/installclass.py
index 9514097..a417762 100644
--- a/installclass.py
+++ b/installclass.py
@@ -191,7 +191,7 @@ class BaseInstallClass(object):
if bootreq:
autorequests.extend(bootreq)

- (minswap, maxswap) = iutil.swapSameAsRam()
+ (minswap, maxswap) = iutil.swapSuggestion()
autorequests.append(PartSpec(fstype="swap", size=minswap, maxSize=maxswap,
grow=True, asVol=True))

diff --git a/iutil.py b/iutil.py
index f7254e2..c583fe2 100644
--- a/iutil.py
+++ b/iutil.py
@@ -447,52 +447,34 @@ def memInstalled():
## Suggest the size of the swap partition that will be created.
# @param quiet Should size information be logged?
# @return A tuple of the minimum and maximum swap size, in megabytes.
-def swapSuggestion(quiet=0):
+def swapSuggestion(quiet=0, hibernation=False):
mem = memInstalled()/1024
mem = ((mem/16)+1)*16
if not quiet:
log.info("Detected %sM of memory", mem)
-
- #table suggested in rhbz#744129
- if mem <= 4096:
- minswap = 2048
- maxswap = 2048

- elif 4096 < mem <= 16384:
- minswap = 4096
- maxswap = 4096
+ #chart suggested in the discussion with other teams
+ #see: https://home.corp.redhat.com/wiki/swap-size-recommendations
+ if mem < 2048:
+ swap = 2 * mem

- elif 16384 < mem <= 65536:
- minswap = 8192
- maxswap = 8192
+ elif 2048 <= mem < 8192:
+ swap = mem

- elif 65536 < mem <= 262144:
- minswap = 16384
- maxswap = 16384
+ elif 8192 <= mem < 65536:
+ swap = mem / 2

else:
- minswap = 32768
- maxswap = 32768
+ swap = 4096

if not quiet:
- log.info("Swap attempt of %sM to %sM", minswap, maxswap)
+ log.info("Swap attempt of %sM", swap)

- return (minswap, maxswap)
+ if hibernation and mem <= 65536:
+ swap = mem + swap

-def swapSameAsRam(quiet=0):
- mem = memInstalled() / 1024
- mem = ((mem / 16) + 1) * 16
- if not quiet:
- log.info("Detected %sM of memory", mem)
-
- #see #rhbz587152
- if mem <= SWAP_SIZE_LIMIT:
- log.info("Swap attempt of %sM to %sM", mem, mem)
- return (mem, mem)
- else:
- log.warning("Cannot create swap of size %sM, using upper bound %sM",
- mem, SWAP_SIZE_LIMIT)
- return (SWAP_SIZE_LIMIT, SWAP_SIZE_LIMIT)
+ #we have to return minimum and maximum swap size
+ return (swap, swap)

## Create a directory path. Don't fail if the directory already exists.
# @param dir The directory path to create.
diff --git a/kickstart.py b/kickstart.py
index c28f030..198982a 100644
--- a/kickstart.py
+++ b/kickstart.py
@@ -739,13 +739,10 @@ class PartitionData(commands.partition.RHEL6_PartData):
if self.mountpoint == "swap":
type = "swap"
self.mountpoint = ""
- if self.recommended:
- (self.size, self.maxSizeMB) = iutil.swapSuggestion()
+ if self.recommended or self.hibernation:
+ (self.size, self.maxSizeMB) = iutil.swapSuggestion(self.hibernation)
self.grow = True

- if self.sameAsRam:
- (self.size, self.maxSizeMB) = iutil.swapSameAsRam()
- self.grow = False
# if people want to specify no mountpoint for some reason, let them
# this is really needed for pSeries boot partitions
elif self.mountpoint == "None":
--
1.7.4.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 05-08-2012, 03:33 PM
Vratislav Podzimek
 
Default Change swap suggestions to the chart proposed in the discussion

There was quite a long discussion [1] about swap size suggestions and
this algorithm is the result. Moreover we should use 'swap --hibernation'
instead of 'swap --same-as-ram'.

[1] https://home.corp.redhat.com/wiki/swap-size-recommendations

Resolves: rhbz#744129
Resolves: rhbz#815557
---
installclass.py | 2 +-
iutil.py | 48 +++++++++++++++---------------------------------
kickstart.py | 7 ++-----
3 files changed, 18 insertions(+), 39 deletions(-)

diff --git a/installclass.py b/installclass.py
index 9514097..a417762 100644
--- a/installclass.py
+++ b/installclass.py
@@ -191,7 +191,7 @@ class BaseInstallClass(object):
if bootreq:
autorequests.extend(bootreq)

- (minswap, maxswap) = iutil.swapSameAsRam()
+ (minswap, maxswap) = iutil.swapSuggestion()
autorequests.append(PartSpec(fstype="swap", size=minswap, maxSize=maxswap,
grow=True, asVol=True))

diff --git a/iutil.py b/iutil.py
index f7254e2..c583fe2 100644
--- a/iutil.py
+++ b/iutil.py
@@ -447,52 +447,34 @@ def memInstalled():
## Suggest the size of the swap partition that will be created.
# @param quiet Should size information be logged?
# @return A tuple of the minimum and maximum swap size, in megabytes.
-def swapSuggestion(quiet=0):
+def swapSuggestion(quiet=0, hibernation=False):
mem = memInstalled()/1024
mem = ((mem/16)+1)*16
if not quiet:
log.info("Detected %sM of memory", mem)
-
- #table suggested in rhbz#744129
- if mem <= 4096:
- minswap = 2048
- maxswap = 2048

- elif 4096 < mem <= 16384:
- minswap = 4096
- maxswap = 4096
+ #chart suggested in the discussion with other teams
+ #see: https://home.corp.redhat.com/wiki/swap-size-recommendations
+ if mem < 2048:
+ swap = 2 * mem

- elif 16384 < mem <= 65536:
- minswap = 8192
- maxswap = 8192
+ elif 2048 <= mem < 8192:
+ swap = mem

- elif 65536 < mem <= 262144:
- minswap = 16384
- maxswap = 16384
+ elif 8192 <= mem < 65536:
+ swap = mem / 2

else:
- minswap = 32768
- maxswap = 32768
+ swap = 4096

if not quiet:
- log.info("Swap attempt of %sM to %sM", minswap, maxswap)
+ log.info("Swap attempt of %sM", swap)

- return (minswap, maxswap)
+ if hibernation and mem <= 65536:
+ swap = mem + swap

-def swapSameAsRam(quiet=0):
- mem = memInstalled() / 1024
- mem = ((mem / 16) + 1) * 16
- if not quiet:
- log.info("Detected %sM of memory", mem)
-
- #see #rhbz587152
- if mem <= SWAP_SIZE_LIMIT:
- log.info("Swap attempt of %sM to %sM", mem, mem)
- return (mem, mem)
- else:
- log.warning("Cannot create swap of size %sM, using upper bound %sM",
- mem, SWAP_SIZE_LIMIT)
- return (SWAP_SIZE_LIMIT, SWAP_SIZE_LIMIT)
+ #we have to return minimum and maximum swap size
+ return (swap, swap)

## Create a directory path. Don't fail if the directory already exists.
# @param dir The directory path to create.
diff --git a/kickstart.py b/kickstart.py
index c28f030..f867a24 100644
--- a/kickstart.py
+++ b/kickstart.py
@@ -739,13 +739,10 @@ class PartitionData(commands.partition.RHEL6_PartData):
if self.mountpoint == "swap":
type = "swap"
self.mountpoint = ""
- if self.recommended:
- (self.size, self.maxSizeMB) = iutil.swapSuggestion()
+ if self.recommended or self.hibernation:
+ (self.size, self.maxSizeMB) = iutil.swapSuggestion(hibernation=self.hibernation)
self.grow = True

- if self.sameAsRam:
- (self.size, self.maxSizeMB) = iutil.swapSameAsRam()
- self.grow = False
# if people want to specify no mountpoint for some reason, let them
# this is really needed for pSeries boot partitions
elif self.mountpoint == "None":
--
1.7.4.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 07:42 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org