linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: No swap can be dangerous (was Re: swap on RAID (was Re: swp - Re: ext3 journal on software raid))
       [not found]   ` <41DD798F.8030902@h3c.com>
@ 2005-01-06 22:08     ` Andrew Walrond
  2005-01-06 22:34       ` Jesper Juhl
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Walrond @ 2005-01-06 22:08 UTC (permalink / raw)
  To: linux-raid; +Cc: linux-kernel

On Thursday 06 January 2005 17:46, Mike Hardy wrote:
>
> You are correct that I was getting at the zero swap argument - and I
> agree that it is vastly different from simply not expecting it. It is
> important to know that there is no inherent need for swap in the kernel
> though - it is simply used as more "memory" (albeit slower, and with
> some optimizations to work better with real memory) and if you don't
> need it, you don't need it.
>

If I recollect a recent thread on LKML correctly, your 'no inherent need for 
swap' might be wrong.

I think the gist was this: the kernel can sometimes needs to move bits of 
memory in order to free up dma-able ram, or lowmem. If I recall correctly, 
the kernel can only do this move via swap, even if there is stacks of free 
(non-dmaable or highmem) memory.

I distinctly remember the moral of the thread being "Always mount some swap, 
if you can"

This might have changed though, or I might have got it completely wrong. - 
I've cc'ed LKML incase somebody more knowledgeable can comment...

Andrew Walrond

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: No swap can be dangerous (was Re: swap on RAID (was Re: swp - Re: ext3 journal on software raid))
  2005-01-06 22:08     ` No swap can be dangerous (was Re: swap on RAID (was Re: swp - Re: ext3 journal on software raid)) Andrew Walrond
@ 2005-01-06 22:34       ` Jesper Juhl
  2005-01-06 22:57         ` Mike Hardy
  0 siblings, 1 reply; 6+ messages in thread
From: Jesper Juhl @ 2005-01-06 22:34 UTC (permalink / raw)
  To: Andrew Walrond; +Cc: linux-raid, linux-kernel

On Thu, 6 Jan 2005, Andrew Walrond wrote:

> On Thursday 06 January 2005 17:46, Mike Hardy wrote:
> >
> > You are correct that I was getting at the zero swap argument - and I
> > agree that it is vastly different from simply not expecting it. It is
> > important to know that there is no inherent need for swap in the kernel
> > though - it is simply used as more "memory" (albeit slower, and with
> > some optimizations to work better with real memory) and if you don't
> > need it, you don't need it.
> >
> 
> If I recollect a recent thread on LKML correctly, your 'no inherent need for 
> swap' might be wrong.
> 
> I think the gist was this: the kernel can sometimes needs to move bits of 
> memory in order to free up dma-able ram, or lowmem. If I recall correctly, 
> the kernel can only do this move via swap, even if there is stacks of free 
> (non-dmaable or highmem) memory.
> 
> I distinctly remember the moral of the thread being "Always mount some swap, 
> if you can"
> 
> This might have changed though, or I might have got it completely wrong. - 
> I've cc'ed LKML incase somebody more knowledgeable can comment...
> 

http://kerneltrap.org/node/view/3202


-- 
Jesper Juhl



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: No swap can be dangerous (was Re: swap on RAID (was Re: swp - Re: ext3 journal on software raid))
  2005-01-06 22:34       ` Jesper Juhl
@ 2005-01-06 22:57         ` Mike Hardy
  2005-01-06 23:15           ` Guy
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Hardy @ 2005-01-06 22:57 UTC (permalink / raw)
  To: Jesper Juhl; +Cc: Andrew Walrond, linux-raid, linux-kernel



Jesper Juhl wrote:
> On Thu, 6 Jan 2005, Andrew Walrond wrote:
> 
> 
>>On Thursday 06 January 2005 17:46, Mike Hardy wrote:
>>
>>>You are correct that I was getting at the zero swap argument - and I
>>>agree that it is vastly different from simply not expecting it. It is
>>>important to know that there is no inherent need for swap in the kernel
>>>though - it is simply used as more "memory" (albeit slower, and with
>>>some optimizations to work better with real memory) and if you don't
>>>need it, you don't need it.
>>>
>>
>>If I recollect a recent thread on LKML correctly, your 'no inherent need for 
>>swap' might be wrong.
>>
>>I think the gist was this: the kernel can sometimes needs to move bits of 
>>memory in order to free up dma-able ram, or lowmem. If I recall correctly, 
>>the kernel can only do this move via swap, even if there is stacks of free 
>>(non-dmaable or highmem) memory.
>>
>>I distinctly remember the moral of the thread being "Always mount some swap, 
>>if you can"
>>
>>This might have changed though, or I might have got it completely wrong. - 
>>I've cc'ed LKML incase somebody more knowledgeable can comment...
>>
> 
> 
> http://kerneltrap.org/node/view/3202
> 

Interesting - I was familiar with the original swappiness thread 
(http://kerneltrap.org/node/view/3000) but haven't seen anything since 
then (I mainly follow via kernel-traffic - enjoyable, but nowhere near 
real time). There's clearly been a bunch more discussion...

Not to rehash the performance arguments, but it appears from my read of 
the kernel trap page referenced above that the primary argument for swap 
is still the performance argument - I didn't see anything referencing 
swap being necessary to move DMAable ram or lowmem. Was that posted 
previously on linux-kernel but not on kerneltrap?

I'm still under the impression that "to swap or not" is a 
performance/policy/risk-management question, not a correctness question. 
If I'm wrong, I'd definitely like to know...

-Mike

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: No swap can be dangerous (was Re: swap on RAID (was Re: swp - Re: ext3 journal on software raid))
  2005-01-06 22:57         ` Mike Hardy
@ 2005-01-06 23:15           ` Guy
  2005-01-07  9:28             ` Andrew Walrond
  0 siblings, 1 reply; 6+ messages in thread
From: Guy @ 2005-01-06 23:15 UTC (permalink / raw)
  To: 'Mike Hardy', 'Jesper Juhl'
  Cc: 'Andrew Walrond', linux-raid, linux-kernel

If I MUST/SHOULD have swap space....
Maybe I will create a RAM disk and use it for swap!  :)  :)  :)

Guy

-----Original Message-----
From: linux-raid-owner@vger.kernel.org
[mailto:linux-raid-owner@vger.kernel.org] On Behalf Of Mike Hardy
Sent: Thursday, January 06, 2005 5:58 PM
To: Jesper Juhl
Cc: Andrew Walrond; linux-raid@vger.kernel.org; linux-kernel@vger.kernel.org
Subject: Re: No swap can be dangerous (was Re: swap on RAID (was Re: swp -
Re: ext3 journal on software raid))



Jesper Juhl wrote:
> On Thu, 6 Jan 2005, Andrew Walrond wrote:
> 
> 
>>On Thursday 06 January 2005 17:46, Mike Hardy wrote:
>>
>>>You are correct that I was getting at the zero swap argument - and I
>>>agree that it is vastly different from simply not expecting it. It is
>>>important to know that there is no inherent need for swap in the kernel
>>>though - it is simply used as more "memory" (albeit slower, and with
>>>some optimizations to work better with real memory) and if you don't
>>>need it, you don't need it.
>>>
>>
>>If I recollect a recent thread on LKML correctly, your 'no inherent need
for 
>>swap' might be wrong.
>>
>>I think the gist was this: the kernel can sometimes needs to move bits of 
>>memory in order to free up dma-able ram, or lowmem. If I recall correctly,

>>the kernel can only do this move via swap, even if there is stacks of free

>>(non-dmaable or highmem) memory.
>>
>>I distinctly remember the moral of the thread being "Always mount some
swap, 
>>if you can"
>>
>>This might have changed though, or I might have got it completely wrong. -

>>I've cc'ed LKML incase somebody more knowledgeable can comment...
>>
> 
> 
> http://kerneltrap.org/node/view/3202
> 

Interesting - I was familiar with the original swappiness thread 
(http://kerneltrap.org/node/view/3000) but haven't seen anything since 
then (I mainly follow via kernel-traffic - enjoyable, but nowhere near 
real time). There's clearly been a bunch more discussion...

Not to rehash the performance arguments, but it appears from my read of 
the kernel trap page referenced above that the primary argument for swap 
is still the performance argument - I didn't see anything referencing 
swap being necessary to move DMAable ram or lowmem. Was that posted 
previously on linux-kernel but not on kerneltrap?

I'm still under the impression that "to swap or not" is a 
performance/policy/risk-management question, not a correctness question. 
If I'm wrong, I'd definitely like to know...

-Mike
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: No swap can be dangerous (was Re: swap on RAID (was Re: swp - Re: ext3 journal on software raid))
  2005-01-06 23:15           ` Guy
@ 2005-01-07  9:28             ` Andrew Walrond
  2005-02-28 20:07               ` Guy
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Walrond @ 2005-01-07  9:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: Guy, 'Mike Hardy', 'Jesper Juhl', linux-raid, alan

On Thursday 06 January 2005 23:15, Guy wrote:
> If I MUST/SHOULD have swap space....
> Maybe I will create a RAM disk and use it for swap!  :)  :)  :)

Well, indeed, I had the same thought. As long as you could guarantee that the 
ram was of the highmem/non-dmaable type...

But we're getting ahead of ourselves. I think we need an authoritive answer to 
the original premise. Perhaps Alan (cc-ed) might spare us a moment?

Did I dream this up, or is it correct?

"I think the gist was this: the kernel can sometimes needs to move bits of 
memory in order to free up dma-able ram, or lowmem. If I recall correctly, 
the kernel can only do this move via swap, even if there is stacks of free 
(non-dmaable or highmem) memory."

Andrew

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: No swap can be dangerous (was Re: swap on RAID (was Re: swp - Re: ext3 journal on software raid))
  2005-01-07  9:28             ` Andrew Walrond
@ 2005-02-28 20:07               ` Guy
  0 siblings, 0 replies; 6+ messages in thread
From: Guy @ 2005-02-28 20:07 UTC (permalink / raw)
  To: 'Andrew Walrond', linux-kernel
  Cc: 'Mike Hardy', 'Jesper Juhl', linux-raid, alan

I was just kidding about the RAM disk!

I think swapping to a RAM disk can't work.
Let's assume a page is swapped out.  Now the first page of swap space is
used, and memory is now allocated for it.  Now assume the process frees the
memory, the page in swap can now be freed, but the RAM disk still has the
memory allocated, just not used.  Now if the Kernel were to swap the first
page of that RAM disk, it may be swapped to the first page of swap, which
would change the data in the RAM disk which is being swapped out.  So, I
guess it can't be swapped, or must be re-swapped, or new memory is
allocated.  In any event, that 1 block will never be un-swapped, since it
will never be needed.  Each time the Kernel attempts to swap some of the RAM
disk the RAM disk's memory usage will increase.  This will continue until
all of the RAM disk is used and there is no available swap space left.  Swap
will be full of swap.  :)

I hope that is clear!  It makes my head hurt!

I don't know about lomem or DMAable memory.  But if special memory does
exists....
It seems like if the Kernel can move memory to disk, it would be easier to
move memory to memory.  So, if special memory is needed, the Kernel should
be able to relocate as needed.  Maybe no code exists to do that, but I think
it would be easier to do than to swap to disk (assuming you have enough free
memory).

Guy

-----Original Message-----
From: Andrew Walrond [mailto:andrew@walrond.org] 
Sent: Friday, January 07, 2005 4:28 AM
To: linux-kernel@vger.kernel.org
Cc: Guy; 'Mike Hardy'; 'Jesper Juhl'; linux-raid@vger.kernel.org;
alan@lxorguk.ukuu.org.uk
Subject: Re: No swap can be dangerous (was Re: swap on RAID (was Re: swp -
Re: ext3 journal on software raid))

On Thursday 06 January 2005 23:15, Guy wrote:
> If I MUST/SHOULD have swap space....
> Maybe I will create a RAM disk and use it for swap!  :)  :)  :)

Well, indeed, I had the same thought. As long as you could guarantee that
the 
ram was of the highmem/non-dmaable type...

But we're getting ahead of ourselves. I think we need an authoritive answer
to 
the original premise. Perhaps Alan (cc-ed) might spare us a moment?

Did I dream this up, or is it correct?

"I think the gist was this: the kernel can sometimes needs to move bits of 
memory in order to free up dma-able ram, or lowmem. If I recall correctly, 
the kernel can only do this move via swap, even if there is stacks of free 
(non-dmaable or highmem) memory."

Andrew


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-03-01 18:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <41DC9420.5030701@h3c.com>
     [not found] ` <20050106093811.GB99565@caffreys.strugglers.net>
     [not found]   ` <41DD798F.8030902@h3c.com>
2005-01-06 22:08     ` No swap can be dangerous (was Re: swap on RAID (was Re: swp - Re: ext3 journal on software raid)) Andrew Walrond
2005-01-06 22:34       ` Jesper Juhl
2005-01-06 22:57         ` Mike Hardy
2005-01-06 23:15           ` Guy
2005-01-07  9:28             ` Andrew Walrond
2005-02-28 20:07               ` Guy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).