Re: Clearing linux buffers and caches

2009-07-08 Thread Martin Schwidefsky
On Wed, 8 Jul 2009 03:00:27 +0200
Ivan Warren  wrote:

> cmm-1 (arch/s390/mm/cmm.c) uses SMSGs to communicate with the VMRM
> service virtual machine. The VMRM will instruct the guest to release its
> pages using good ole Diag 10.. nothing fancy here..

diag 10 actively tells z/VM that the page is free.

> cmma (arch/s390/mm/page_states.c) uses the B9AB instruction to indicate
> to CP which pages linux no longer needs.. It uses the standard Linux MM
> mechanism to be instructed to do so. (page_free()).. The only diff
> between Diag 10 and B9AB is that a page marked "Unused" with B9AB will
> generate an Addressing Exception (PIC 5) if you attempt to access it,
> while Diag 10 won't do that.

The B9AB instruction will mark a page as free in the pgste. That does
not cause a sie exit to z/VM which means z/VM doesn't know the page is
free until it does a page scan for the guest. So you won't see an
immediate effect in the z/VM page counts. If z/VM needs memory it will
eventually find the unused pages and the page count will drop belately.

--
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


Re: Clearing linux buffers and caches

2009-07-07 Thread Ivan Warren

Mark Post wrote:

But that wasn't your comment/question.  You asked if my original answer would 
apply to CMMA, and I said no, it would not apply to CMMA, since that is an 
architected interface between Linux and z/VM, implying that the drop cache 
/proc interface is not.  And indeed it is not.  Using CMM-1 (and possibly 
CMMA/CMM-2 if you're brave enough) will achieve real storage savings and, 
unless mis-handled by VMRM or the system administrator, not adversely affect 
performance of the Linux guest.  Using the /proc interface to drop cache and 
buffers is not recommended in a production environment.



Ok.. Just a communication problem then..

My comment addressed a specific portion of your statement :

"Just because linux no longer treats those pages as being used doesn't
mean z/VM sees them as free".

My (verbatim) comment was :

"Does this still hold true when using CMMA ?"

This may have been the reason why we had a miscommunication - I wasn't
specific enough about what portion of your statement I was referring to.

I was making this comment since I was under the impression that CMMA's
intent is to allow linux to indicate explicit page disposition to CP.

Bah.; anyway.. no big deal ;)

--Ivan

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


smime.p7s
Description: S/MIME Cryptographic Signature


Re: Clearing linux buffers and caches

2009-07-07 Thread Mark Post
>>> On 7/7/2009 at  9:00 PM, Ivan Warren  wrote: 
> To which I commented : Would CMMA change this ? To which you answered "no" 
> (with the implication that linux free page management is not connected to 
> z/VM's own free page management - but only a protocol to

But that wasn't your comment/question.  You asked if my original answer would 
apply to CMMA, and I said no, it would not apply to CMMA, since that is an 
architected interface between Linux and z/VM, implying that the drop cache 
/proc interface is not.  And indeed it is not.  Using CMM-1 (and possibly 
CMMA/CMM-2 if you're brave enough) will achieve real storage savings and, 
unless mis-handled by VMRM or the system administrator, not adversely affect 
performance of the Linux guest.  Using the /proc interface to drop cache and 
buffers is not recommended in a production environment.


Mark Post

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


Re: Clearing linux buffers and caches

2009-07-07 Thread Ivan Warren

Mark Post wrote:


In the context of the original question, I stand by my response.  Introducing 
all sort of hypothetical situations will change just about any answer.



Mark,

I don't understand..

The original question was :

Will "sync; echo 3 > /proc/sys/vm/drop_caches" have any adverse effect ?

Your answer was :

"Yes, just because linux no longer treats those pages as being used
doesn't mean z/VM sees them as free" - and your statement is that the
only solution to ensure linux doesn't eat more memory than it needs to
is to adjust the virtual machine's storage size.

To which I commented : Would CMMA change this ?

To which you answered "no" (with the implication that linux free page
management is not connected to z/VM's own free page management - but
only a protocol to

After which, I looked into the source code and the relevant CP manual
and disagree with your analysis since those information seem to dismiss
your answer.

What "hypothetical" situation are you talking about ? Using CMMA (but
that was part of my question) ? Running linux under z/VM (which you
already implied in your answer) ? or that flushing buffer/cache will
call linux Memory Management free_page() function ?

--Ivan

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


smime.p7s
Description: S/MIME Cryptographic Signature


Re: Clearing linux buffers and caches

2009-07-07 Thread Ivan Warren

Rob van der Heij wrote:

On Wed, Jul 8, 2009 at 1:26 AM, Ivan Warren wrote:



What I am saying is that, on the contrary, when linux treats those pages
as no longer being in use, z/VM *WILL* see them as free !



I think you have read too much glossy marketing PDFs :-)   All we know
is that VM *could* see it as free and we know it's not always looking
for it at that place. And in fact, in this case Holy Page Management
Assist is likely to do the thing.

I second Mark that CMM-1 is the thing immediately frees the backing
pages in z/VM. I use it on my test servers to reduce the footprint
when I am done with my tests. It's not true that CMM-1 involves
another virtual machine to do that (only if you choose to use VMRM to
steer CMM).


I haven't read any of the (glossy or not) marketing PDFs ! I'm reading
the linux 2.6 source code and the z/VM CP System services manuals.

cmm-1 (arch/s390/mm/cmm.c) uses SMSGs to communicate with the VMRM
service virtual machine. The VMRM will instruct the guest to release its
pages using good ole Diag 10.. nothing fancy here..

cmma (arch/s390/mm/page_states.c) uses the B9AB instruction to indicate
to CP which pages linux no longer needs.. It uses the standard Linux MM
mechanism to be instructed to do so. (page_free()).. The only diff
between Diag 10 and B9AB is that a page marked "Unused" with B9AB will
generate an Addressing Exception (PIC 5) if you attempt to access it,
while Diag 10 won't do that.

Ok.. maybe I'm confusing the terminology.. but that's what's in the
linux source code..

--Ivan

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


smime.p7s
Description: S/MIME Cryptographic Signature


Re: Clearing linux buffers and caches

2009-07-07 Thread Rob van der Heij
On Wed, Jul 8, 2009 at 1:26 AM, Ivan Warren wrote:

> What I am saying is that, on the contrary, when linux treats those pages
> as no longer being in use, z/VM *WILL* see them as free !

I think you have read too much glossy marketing PDFs :-)   All we know
is that VM *could* see it as free and we know it's not always looking
for it at that place. And in fact, in this case Holy Page Management
Assist is likely to do the thing.

I second Mark that CMM-1 is the thing immediately frees the backing
pages in z/VM. I use it on my test servers to reduce the footprint
when I am done with my tests. It's not true that CMM-1 involves
another virtual machine to do that (only if you choose to use VMRM to
steer CMM).

Rob
--
Rob van der Heij
Velocity Software
http://www.velocitysoftware.com/

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


Re: Clearing linux buffers and caches

2009-07-07 Thread Mark Post
>>> On 7/7/2009 at  7:26 PM, Ivan Warren  wrote: 
> You were stating : MP: - "Just because Linux no longer treats those pages as 
> being used doesn't mean z/VM sees them as free." What I am saying is that, on 
> the contrary, when linux treats those pages as no longer being in use, z/VM 
> *WILL* see them as free !

In the context of the original question, I stand by my response.  Introducing 
all sort of hypothetical situations will change just about any answer.


Mark Post

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


Re: Clearing linux buffers and caches

2009-07-07 Thread Ivan Warren

Mark Post wrote:

Of course not.  CMM and CMMA are designed interfaces between Linux and z/VM.  
Their whole purpose in life is to let the two work together on virtual memory 
management.




Precisely !

if the linux kernel deems the page to be 'free' (and dropping a page
from buffer/cache should do that - but then again, maybe not - and then
I'll go back to my corner), and CMMA is available and functional (that
is, activated and you have the right level of z/VM with the right PTFs),
then the kernel Memory Manager (mm/page_alloc) should call the CMMA
arch_free_page()

In turn, arch/s390/mm/page_states.c[arch_free_page] (page_states.c IS
CMMA) calls the z/VM EXTRACT_AND_SET_STORAGE_ATTRIBUTE (B9AB)
instruction to indicate to CP that the page is no longer needed.
arch_free_state sets the page to the 'Unused' state (as per 6.1.4.4 of
the z/VM 5.4 CP Programing services)

Setting the page to an 'Unused' state should make any physical page
associated with the virtual page eligible to be reused for other purpose
as well as free any associated paging slot as the guest operating system
is declaring by that action that it won't be needing that page until it
puts it back into a 'Stable' state.

Thus achieving the intended result.

You were stating :

MP:
- "Just because Linux no longer treats those pages as being used doesn't
mean z/VM sees them as free."

What I am saying is that, on the contrary, when linux treats those pages
as no longer being in use, z/VM *WILL* see them as free !

...

CMM is different.. It uses a service virtual machine and is a completely
different mechanism..

...

Then again, it's probably a better idea to let Linux and z/VM handle
caching, buffering, paging and whatnot using their own heuristics than
using a sledgehammer approach to flush the cache at regular intervals.

--Ivan

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


smime.p7s
Description: S/MIME Cryptographic Signature


Re: Clearing linux buffers and caches

2009-07-07 Thread Rob van der Heij
On Wed, Jul 8, 2009 at 12:16 AM, Mark Post wrote:

> Yes, it will hurt your Linux system's performance, while not doing anything 
> useful.

It was meant as a way for benchmarks to start off with a clean cache
so the first test does not spoil the next one. But if you want to do
that on z/VM, you should also get rid of the real pages that back you
(and be aware that the size of the available list makes a difference,
and the other users, etc).

It may also help to provide a starting point for how much memory you
can take away with CMM

Rob van der Heij
Velocity Software
http://www.velocitysoftware.com/

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


Re: Clearing linux buffers and caches

2009-07-07 Thread Mark Post
>>> On 7/7/2009 at  6:37 PM, Ivan Warren  wrote: 
> Does that still hold true when using CMMA ?

Of course not.  CMM and CMMA are designed interfaces between Linux and z/VM.  
Their whole purpose in life is to let the two work together on virtual memory 
management.


Mark Post

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


Re: Clearing linux buffers and caches

2009-07-07 Thread Ivan Warren

Mark Post wrote:

Yes, it will hurt your Linux system's performance, while not doing anything useful.  Just 
because Linux no longer treats those pages as being used doesn't mean z/VM sees them as 
free.  If you want to make sure Linux "doesn't eat up any more memory than it needs 
to" then shrink the size of the guest.  (Or the LPAR if you're unfortunate enough to 
not have z/VM.)



Does that still hold true when using CMMA ?

--Ivan

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390


smime.p7s
Description: S/MIME Cryptographic Signature


Re: Clearing linux buffers and caches

2009-07-07 Thread Mark Post
>>> On 7/7/2009 at  6:02 PM, Deric Abel  wrote: 
-snip-
> Is there any harm in running this command, and if not, what about setting it 
> to run every hour or so in cron, therefore making sure that linux doesn't eat 
> up any more memory then it needs to?

Yes, it will hurt your Linux system's performance, while not doing anything 
useful.  Just because Linux no longer treats those pages as being used doesn't 
mean z/VM sees them as free.  If you want to make sure Linux "doesn't eat up 
any more memory than it needs to" then shrink the size of the guest.  (Or the 
LPAR if you're unfortunate enough to not have z/VM.)


Mark Post

--
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390