2004-06-01 11:57:04

by Lenar Lõhmus

[permalink] [raw]
Subject: Re: why swap at all?

[email protected] wrote:

>I'm not sure. Copying a file is a pretty good indication that you
>are about to do something with either the new or the old file.
>
>
>
Like taking the new file with me on USB dongle and deleting old one?
Caching the file really doesn't help in this case.

Lenar


2004-06-01 12:27:41

by Robin Rosenberg

[permalink] [raw]
Subject: Re: why swap at all?

On Tuesday 01 June 2004 13.57, Lenar L?hmus wrote:
> [email protected] wrote:
> >I'm not sure. Copying a file is a pretty good indication that you
> >are about to do something with either the new or the old file.
>
> Like taking the new file with me on USB dongle and deleting old one?
> Caching the file really doesn't help in this case.

No, and most file copies are not to be used in the "near" future. I.e. on
my machine. Caching on the second read (close in time) is ok, or if there
are unused ram, but paging out things in use is bad. It's much more likely
that the page allocated to a program will be used than a newly read or written
file.

Ofcourse your milega may vary. I'm thinking of my desktop now.

-- robin

2004-06-01 16:49:49

by jlnance

[permalink] [raw]
Subject: Re: why swap at all?

On Tue, Jun 01, 2004 at 02:57:00PM +0300, Lenar L?hmus wrote:
> [email protected] wrote:
>
> >I'm not sure. Copying a file is a pretty good indication that you
> >are about to do something with either the new or the old file.
> >
> Like taking the new file with me on USB dongle and deleting old one?
> Caching the file really doesn't help in this case.

No, it does not help in this case.

Not putting things in cache is a solution for the problem of
having useful stuff pushed out of the cache. However, fixing
the problem this way may create other problems if it causes
us to fail to put useful things into the cache.

The point I was trying (perhaps unsuccessfully) to make, is
that we should be careful about not caching things. We are
likely to break other corner cases by fixing the ones we
are discussing.

Thanks,

Jim

2004-06-01 17:39:44

by Martin Olsson

[permalink] [raw]
Subject: Re: why swap at all? (what the user feels)

Hi,

From a pure *users* perspective the most evil part of my computer is
the harddrive, because it has three bad properties;

-- its slowing stuff down
-- its very noisy
-- its sucks my battery dry (on laptops)

I dont care as much about how fast or efficient the swapping system
really is, what does annoy me is when it lets me down. Say I do some
action repeatedly every once in a while and it always takes about X
milliseconds, when after a while that same action takes 2*X
milliseconds. Now I'm DISAPPOINTED and I got a grudge with kswapd.

Its *emotionally* more 'okay' for the harddrive to its thing when I
initiate it through some action (launching program, copying files)
because then I expect it.

From what I've read previously in this thread, it seems to me that the
only major problem with swapping that not all users want file system
cache to swap out actual applications (thus making that somewhat aged
mozilla window abit laggy).

Maybe we could just have a "Allow file system cache to swap out
applications checkbox somewhere"?

Or, Am I missing something?




Sincerly,
/m

[email protected] wrote:
> On Tue, Jun 01, 2004 at 02:57:00PM +0300, Lenar L?hmus wrote:
>
>>[email protected] wrote:
>>
>>
>>>I'm not sure. Copying a file is a pretty good indication that you
>>>are about to do something with either the new or the old file.
>>>
>>
>>Like taking the new file with me on USB dongle and deleting old one?
>>Caching the file really doesn't help in this case.
>
>
> No, it does not help in this case.
>
> Not putting things in cache is a solution for the problem of
> having useful stuff pushed out of the cache. However, fixing
> the problem this way may create other problems if it causes
> us to fail to put useful things into the cache.
>
> The point I was trying (perhaps unsuccessfully) to make, is
> that we should be careful about not caching things. We are
> likely to break other corner cases by fixing the ones we
> are discussing.
>
> Thanks,
>
> Jim
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>

2004-06-01 17:57:39

by Valdis Klētnieks

[permalink] [raw]
Subject: Re: why swap at all? (what the user feels)

On Tue, 01 Jun 2004 19:38:54 +0200, Martin Olsson <[email protected]> said:

> Maybe we could just have a "Allow file system cache to swap out
> applications checkbox somewhere"?
>
> Or, Am I missing something?

Isn't that what /proc/sys/vm/swappiness is for? (And yes, I know that it's not
a total solution to the whole range of conflicting requirements that we have -
I suspect that it's really difficult to make it work much better than it is
without adding a lot more history-tracking instrumentation).


Attachments:
(No filename) (226.00 B)

2004-06-01 18:02:11

by David Schwartz

[permalink] [raw]
Subject: RE: why swap at all? (what the user feels)


> From what I've read previously in this thread, it seems to me that the
> only major problem with swapping that not all users want file system
> cache to swap out actual applications (thus making that somewhat aged
> mozilla window abit laggy).
>
> Maybe we could just have a "Allow file system cache to swap out
> applications checkbox somewhere"?
>
> Or, Am I missing something?

In practice, that would make no difference at all. Once physical memory is
full (and it pretty much will always be so), every memory request (whether
due to the file system cache or application usage) will require discarding
some page or other. So even if all memory requests due to file system cache
usage were prohibited from forcing out application pages, you're launching
enough other application that need pages that application pages will still
be evicted.

Now, if you make the rule "don't ever swap out application pages", what
exactly is the swap going to do? Swap is for dirty pages. Dirty file pages
get written back to their ultimate home, not swap.

DS


2004-06-01 19:01:48

by Robin Rosenberg

[permalink] [raw]
Subject: Re: why swap at all? (what the user feels)

On Tuesday 01 June 2004 20.01, David Schwartz wrote:
> > From what I've read previously in this thread, it seems to me that the
> > only major problem with swapping that not all users want file system
> > cache to swap out actual applications (thus making that somewhat aged
> > mozilla window abit laggy).
> >
> > Maybe we could just have a "Allow file system cache to swap out
> > applications checkbox somewhere"?
> >
> > Or, Am I missing something?
>
> In practice, that would make no difference at all. Once physical memory is
> full (and it pretty much will always be so), every memory request (whether

No.

Many people have machines with plenty of RAM (512MB or more is pretty much
standard on new machines), much of which is only used to cache files. The
file cache is the reason the memory is full.

-- robin

2004-06-01 19:05:24

by David Schwartz

[permalink] [raw]
Subject: RE: why swap at all? (what the user feels)


> On Tuesday 01 June 2004 20.01, David Schwartz wrote:
> > > From what I've read previously in this thread, it seems to
> > > me that the
> > > only major problem with swapping that not all users want file system
> > > cache to swap out actual applications (thus making that somewhat aged
> > > mozilla window abit laggy).
> > >
> > > Maybe we could just have a "Allow file system cache to swap out
> > > applications checkbox somewhere"?
> > >
> > > Or, Am I missing something?

> > In practice, that would make no difference at all. Once
> > physical memory is
> > full (and it pretty much will always be so), every memory
> request (whether

> No.

Huh?

> Many people have machines with plenty of RAM (512MB or more is
> pretty much
> standard on new machines), much of which is only used to cache files. The
> file cache is the reason the memory is full.

Of course. That's why I said, "once physical memory is full (and it pretty
much will always be so)". Physical memory is always full, so every memory
request requires that a page be evicted.

DS


2004-06-02 18:44:14

by John Hendrikx

[permalink] [raw]
Subject: Re: why swap at all?

[email protected] wrote:

>On Tue, Jun 01, 2004 at 02:57:00PM +0300, Lenar L?hmus wrote:
>
>
>>[email protected] wrote:
>>
>>
>>
>>>I'm not sure. Copying a file is a pretty good indication that you
>>>are about to do something with either the new or the old file.
>>>
>>>
>>>
>>Like taking the new file with me on USB dongle and deleting old one?
>>Caching the file really doesn't help in this case.
>>
>>
>
>No, it does not help in this case.
>
>Not putting things in cache is a solution for the problem of
>having useful stuff pushed out of the cache. However, fixing
>the problem this way may create other problems if it causes
>us to fail to put useful things into the cache.
>
>The point I was trying (perhaps unsuccessfully) to make, is
>that we should be careful about not caching things. We are
>likely to break other corner cases by fixing the ones we
>are discussing.
>
>
I've experienced the problem where applications need to be swapped back
in. It's mainly caused by the dual role my machine has (desktop machine
when I'm using it, server when it is serving files). Whenever my
machine has been sitting idly serving files for a while, when I get
back, the desktop is slow. However, there is no need for that, as the
files are served at low speeds -- there's no real point in caching them
apart from maybe preventing harddisk wear... the harddisk itself can
serve these files again faster than they will be needed.

So perhaps it is possible to reduce caching of data that is simply not
putting stress on the system (the harddisk in this case). If the
harddisk is not the bottleneck, it is probably not worth caching.
Typical examples are letting a box play music all day (and then trying
to read your mail...), having a webserver on a slow connection or
watching a large movie file. None of these really require much caching
beyond a bit of read-ahead.

I'm not sure how best to distinguish when something is fast I/O that
would benefit from caching and when something is slow I/O that the
harddisk can handle well enough on its own.

--John