Skip to contentSkip to conversation

Swap prefetch merge plans

ck jos poortvliet 5 participants 10 messages Feb 9, 2007 – Feb 10, 2007 3 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Hold.

Why hold?

It's been shown this patchset really helps desktop users.

Has it? I don't think I've ever observed any benefits from it and I don't think anyone has ever got down and worked out what its drawbacks might be, and seen if they can be demonstrated in practice.

Well, I'd say it's disadvantage is that you might use the buffered diskdata in memory (which will be replaced with application data from swap) when you come back using the computer. But it's far more likely you'll use the app data, that's why swap prefetch helps. Anyway, I'm sure you got some response from users who did like it. Now I know the desktop isn't the focus of the Linux Kernel Developers, and you probably have much to hefty hardware to notice any difference. Heck, after my upgrade to 3GB ram, I never noticed swap prefetch anymore...

But there ARE ppl using KDE or Gnome on a 256 MB ram system (or even less) and they would notice this. I know I do on my 192-mb-ram laptop with Kubuntu... It's lovely to do some compiling task, then while you work in vi swap prefetch ensures everything is smooth when you try to continue browsing with firefox...

Quoted 2 lines

I also have vague memories of some serious-sounding review comments about the code from Nick.

Nick's comment, replying to me some time ago:

Quoted 8 lines
Quoted 7 lines

well, the reason i use it is my computer is much more reactive in the morning. linux uses to get very slow after a night of not-doing-much except some 'sleep 5h && blabla' and cron stuff. in the morning it takes a few HOURS to get up and running smoothly. with swap prefetch, it actually feels faster compared to a fresh boot. now you can force swap prefetch to start working, i use it now and then after some heavy taskts which pulled everything to swap.

Quoted 7 lines

I have two issues with this argument (not that I'm trying to say it couldn't make a difference in your case).

Firstly, swap prefetch actually doesn't handle the midnight updatedb pageout problem nicely. It doesn't do any prefetching when the pagecache/vfs cache fills memory (which is what would have to happen for updatedb to push stuff into swap).

But doesn't it prefetch stuff after updatedb has run and the computer is idle? Updatedb here runs at night, and swap prefetch is supposed to get my app data back in memory during the time after updatedb pushed it out, right? Maybe Con can explain here...

Quoted 2 lines

Secondly, with or without swap prefetch, I think we can do a better job of handling these use-once patterns to begin with.

well, i'd love to see you elaborate on this. I mean, if the kernel could be made smarter and swap prefetch wouldn't be needed, great...

Quoted 4 lines
Quoted 1 line

Why keep it in -mm for so long?

I'm waiting to be shown that its benefits exceed its costs. Sometimes that's hard.

Nobody has said anything about costs, indeed. Now afaik, swap prefetch is designed to have no/as little as possible costs, so that makes sense. Does it have to have some bugs, which have to be adressed, before it can enter? I'm sure this can be arranged, right, Con?

Sorry if I sound sarcastic. I'm no hacker myself, and sometimes these discussions don't make sense to me. A bit like the Staircase thingy ->

"hi, I've got this piece of code which does the same as that piece, but better"
"Why didn't you improve the old code?"
"This is a better design -> half the code but doing a better job" "Well, it's not tested as much, so it won't go in. Go away!"

There where those comments from Torvalds some time ago in an interview, about the kernel community becoming harder to get involved with. As an outsider, it sure seems so. I read frustrations everywhere. What about the kevent guy, his
blog: http://tservice.net.ru/~s0mbre/blog

I stumbled upon it when reading LWN. Seems pretty sad... I don't get the technical stuff, but the frustration almost blows up your monitor. Is there something fundamentally wrong with the kernel-hackers-culture, or are these incidents?

grtz

Jos

Signature · 6 lines
Disclaimer:

Alles wat ik doe denk en zeg is gebaseerd op het wereldbeeld wat ik nu heb. 
Ik ben niet verantwoordelijk voor wijzigingen van de wereld, of het beeld wat 
ik daarvan heb, noch voor de daaruit voortvloeiende gedragingen van mezelf. 
Alles wat ik zeg is aardig bedoeld, tenzij expliciet vermeld.
#4 lore raw
Quoted 19 lines · jos poortvliet

Nobody has said anything about costs, indeed. Now afaik, swap prefetch is designed to have no/as little as possible costs, so that makes sense. Does it have to have some bugs, which have to be adressed, before it can enter? I'm sure this can be arranged, right, Con?

Sorry if I sound sarcastic. I'm no hacker myself, and sometimes these discussions don't make sense to me. A bit like the Staircase thingy ->

"hi, I've got this piece of code which does the same as that piece, but better"
"Why didn't you improve the old code?"
"This is a better design -> half the code but doing a better job" "Well, it's not tested as much, so it won't go in. Go away!"

There where those comments from Torvalds some time ago in an interview, about the kernel community becoming harder to get involved with. As an outsider, it sure seems so. I read frustrations everywhere. What about the kevent guy, his blog: http://tservice.net.ru/~s0mbre/blog

Quoted 4 lines

I stumbled upon it when reading LWN. Seems pretty sad... I don't get the technical stuff, but the frustration almost blows up your monitor. Is there something fundamentally wrong with the kernel-hackers-culture, or are these incidents?

I greatly appreciate the support. Truly I do.

But I do not like the direction this argument is going. Please let it go.

Signature · 1 line
-ck
#5 lore raw

Op Friday 09 February 2007, schreef Con Kolivas:

Quoted 20 lines · jos poortvliet
Quoted 19 lines

Nobody has said anything about costs, indeed. Now afaik, swap prefetch is designed to have no/as little as possible costs, so that makes sense. Does it have to have some bugs, which have to be adressed, before it can enter? I'm sure this can be arranged, right, Con?

Sorry if I sound sarcastic. I'm no hacker myself, and sometimes these discussions don't make sense to me. A bit like the Staircase thingy ->

"hi, I've got this piece of code which does the same as that piece, but better"
"Why didn't you improve the old code?"
"This is a better design -> half the code but doing a better job" "Well, it's not tested as much, so it won't go in. Go away!"

There where those comments from Torvalds some time ago in an interview, about the kernel community becoming harder to get involved with. As an outsider, it sure seems so. I read frustrations everywhere. What about the kevent guy, his blog: http://tservice.net.ru/~s0mbre/blog

Quoted 8 lines
Quoted 4 lines

I stumbled upon it when reading LWN. Seems pretty sad... I don't get the technical stuff, but the frustration almost blows up your monitor. Is there something fundamentally wrong with the kernel-hackers-culture, or are these incidents?

I greatly appreciate the support. Truly I do.

But I do not like the direction this argument is going. Please let it go.

Ok. I appologize to those who might have felt attacked, this wasn't meant personally to anybody, more to the community as a whole.

#6 lore raw
In reply to jos poortvliet
Quoted 6 lines · jos poortvliet
Quoted 6 lines
Quoted 5 lines
Quoted 1 line

Hold.

Why hold?

It's been shown this patchset really helps desktop users.

Quoted 8 lines
Quoted 3 lines

Has it? I don't think I've ever observed any benefits from it and I don't think anyone has ever got down and worked out what its drawbacks might be, and seen if they can be demonstrated in practice.

Well, I'd say it's disadvantage is that you might use the buffered diskdata in memory (which will be replaced with application data from swap) when you come back using the computer. But it's far more likely you'll use the app data, that's why swap prefetch helps

swap prefetch stores the data at the tail end of the lru list which means that even if you do want to use that ram for something else, the prefetched pages will be immediately dropped. Since the pages are still on backing store (swapspace) they will be droppped without any further I/O.

Quoted 5 lines

. Anyway, I'm sure you got some
response from users who did like it. Now I know the desktop isn't the focus of the Linux Kernel Developers, and you probably have much to hefty hardware to notice any difference. Heck, after my upgrade to 3GB ram, I never noticed swap prefetch anymore...

Even on 2GB ram at home, where I regularly move iso images around, compress large files with big window compression apps (like rzip), manipulate gimp images, print large colour photos in high resolution and so on, I hit swap regularly and do notice it being helpful. This is what normal desktop users do.

Quoted 6 lines

But there ARE ppl using KDE or Gnome on a 256 MB ram system (or even less) and they would notice this. I know I do on my 192-mb-ram laptop with Kubuntu... It's lovely to do some compiling task, then while you work in vi swap prefetch ensures everything is smooth when you try to continue browsing with firefox...

Indeed.

Quoted 21 lines
Quoted 3 lines

I also have vague memories of some serious-sounding review comments about the code from Nick.

Nick's comment, replying to me some time ago:

Quoted 8 lines
Quoted 7 lines

well, the reason i use it is my computer is much more reactive in the morning. linux uses to get very slow after a night of not-doing-much except some 'sleep 5h && blabla' and cron stuff. in the morning it takes a few HOURS to get up and running smoothly. with swap prefetch, it actually feels faster compared to a fresh boot. now you can force swap prefetch to start working, i use it now and then after some heavy taskts which pulled everything to swap.

Quoted 7 lines

I have two issues with this argument (not that I'm trying to say it couldn't make a difference in your case).

Firstly, swap prefetch actually doesn't handle the midnight updatedb pageout problem nicely. It doesn't do any prefetching when the pagecache/vfs cache fills memory (which is what would have to happen for updatedb to push stuff into swap).

Quoted 4 lines

But doesn't it prefetch stuff after updatedb has run and the computer is idle? Updatedb here runs at night, and swap prefetch is supposed to get my app data back in memory during the time after updatedb pushed it out, right? Maybe Con can explain here...

It can't help the updatedb scenario. Updatedb leaves the ram full and swap prefetch wants to cost as little as possible so it will never move anything out of ram in preference for the pages it wants to swap back in. The use once logic in the vm might if you're lucky help the next time you use the memory, but anything you used prior to updatedb is trashed beyond oblivion and this has nothing to do with swap prefetch.

Quoted 5 lines
Quoted 2 lines

Secondly, with or without swap prefetch, I think we can do a better job of handling these use-once patterns to begin with.

well, i'd love to see you elaborate on this. I mean, if the kernel could be made smarter and swap prefetch wouldn't be needed, great...

They're not mutually exclusive. We will _always_ have a load that causes swapping. Whatever the resources available on a pc, an application will come along that outstrips it. The nature of normal desktops is they're always driven to this level.

Quoted 9 lines
Quoted 4 lines
Quoted 1 line

Why keep it in -mm for so long?

I'm waiting to be shown that its benefits exceed its costs. Sometimes that's hard.

Nobody has said anything about costs, indeed. Now afaik, swap prefetch is designed to have no/as little as possible costs, so that makes sense. Does it have to have some bugs, which have to be adressed, before it can enter? I'm sure this can be arranged, right, Con?

I'm stuck developing code I'm having trouble proving it helps. Normal users find it helps and an artificial testcase shows it helps, but that is not enough, since the normal users will be tainted in their opinion, and the artificial testcase will always be artificial. My mistake of developing novel code in areas that were unquantifiable has been my undoing. If it's unquantifiable, but "obvious" then it has a chance...(like most of what goes into mainline). Precious few of the patches that I keep in -ck belong to that group though.

P.S. Sorry about being harsh in the last email Jos, I understood your frustration.

Signature · 1 line
-ck
#7 lore raw
In reply to jos poortvliet
Quoted 1 line · On Fri, 09 Feb 2007 14:13:03 +0100 jos poortvliet <[email protected]> wrote:

Nick's comment, replying to me some time ago:

I think I was thinking of this:

	http://lkml.org/lkml/2006/2/6/509
Quoted 3 lines

Is there
something fundamentally wrong with the kernel-hackers-culture, or are these incidents?

Well yes, there are incidents. We have too many coders and not enough reviewers, testers and bug-fixers.

If I had two solid days to sit down and carefully review, test, try-to-exploit and if necessary improve/fix this code then perhaps we'd get there. But I'm nowhere vaguely near being able to afford that time and things are just sitting there.

I have an email sitting in my drafts folder stating that I'll no longer accept any features unless they've been publically reviewed in detail and run-time tested by a third party. The idea being to force people to spend more time reviewing and testing each other's stuff and less time writing new stuff. Maybe on a sufficiently gloomy day I'll actually send it.

#8 lore raw
Quoted 8 lines · Andrew Morton

On Fri, 09 Feb 2007 14:13:03 +0100

Quoted 1 line · jos poortvliet

Nick's comment, replying to me some time ago:

I think I was thinking of this:

	http://lkml.org/lkml/2006/2/6/509

Fortunately that predates a lot of changes where I did address all those. These will seem out of context without looking at that original email so I apologise in advance.

buffered_rmqueue and prefetching x86 specific (not into DMA) were dropped

It is NUMA aware

Global cacheline bouncing in page allocation and page reclaim paths I have no answer for as I have to tell swap prefetch that the vm is busy somehow and I do that by setting precisely one bit in a lockless manner.

The trylocks were dropped.

The other ideas were to :
-extend the prefetching. That's extra features
-knowing for sure when a system is really idle. I've tried hard to do that as cheaply as possible.
-putting pages on the lru? well it puts them on the tail -papering over an issue? As I said, no matter how good the vm is, there will always be loads that swap.

Signature · 1 line
-ck
#9 lore raw
Quoted 30 lines · Con Kolivas
Quoted 8 lines · Andrew Morton

On Fri, 09 Feb 2007 14:13:03 +0100

Quoted 1 line · jos poortvliet

Nick's comment, replying to me some time ago:

I think I was thinking of this:

	http://lkml.org/lkml/2006/2/6/509

Fortunately that predates a lot of changes where I did address all those. These will seem out of context without looking at that original email so I apologise in advance.

buffered_rmqueue and prefetching x86 specific (not into DMA) were dropped

It is NUMA aware

Global cacheline bouncing in page allocation and page reclaim paths I have no answer for as I have to tell swap prefetch that the vm is busy somehow and I do that by setting precisely one bit in a lockless manner.

The trylocks were dropped.

The other ideas were to :

(quoted diff) +0 -2
-extend the prefetching. That's extra features
-knowing for sure when a system is really idle. I've tried hard to do that

as cheaply as possible.

(quoted diff) +0 -2
-putting pages on the lru? well it puts them on the tail
-papering over an issue? As I said, no matter how good the vm is, there
Quoted 1 line

will always be loads that swap.

Perhaps I haven't made this clear enough.

Nick has been kind enough to review pretty much all of swap prefetch at every turn. He is understandably suspicious about any code that I generate since I'm a doctor and not a computer programmer. I have addressed every concern he has made along the way and even joked at the end that he "threatened to review it over and over and over" which he did not take in jest.

Swap prefetch has actually had far more review than a lot of code so I'm surprised that this is a remaning concern. It has been reviewed, and I have addressed the concerns. It is possible to hold back code forever at the suggestion that more review is always required, and basically that's what I feel this has become.

If there is one valid concern with swap prefetch, there is a numa=64 scenario that Rohit Seth brought to my attention and I gave him a patch to test 2 months ago. I've pinged him since, but I understand he's busy so has not had a chance to test the patch.

Signature · 1 line
-ck
#10 lore raw
In reply to Andrew Morton
Quoted 6 lines · Andrew Morton

I have an email sitting in my drafts folder stating that I'll no longer accept any features unless they've been publically reviewed in detail and run-time tested by a third party. The idea being to force people to spend more time reviewing and testing each other's stuff and less time writing new stuff. Maybe on a sufficiently gloomy day I'll actually send it.

/me sneaks into Andrew's office and sends it out.

#11 lore raw
Quoted 8 lines · On Fri, 09 Feb 2007 18:35:51 -0500 Chuck Ebbert wrote:
Quoted 6 lines · Andrew Morton

I have an email sitting in my drafts folder stating that I'll no longer accept any features unless they've been publically reviewed in detail and run-time tested by a third party. The idea being to force people to spend more time reviewing and testing each other's stuff and less time writing new stuff. Maybe on a sufficiently gloomy day I'll actually send it.

/me sneaks into Andrew's office and sends it out.

Thanks. 8)

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

#12 lore raw

Op Saturday 10 February 2007, schreef Randy Dunlap:

Quoted 9 lines · On Fri, 09 Feb 2007 18:35:51 -0500 Chuck Ebbert wrote:
Quoted 8 lines
Quoted 6 lines · Andrew Morton

I have an email sitting in my drafts folder stating that I'll no longer accept any features unless they've been publically reviewed in detail and run-time tested by a third party. The idea being to force people to spend more time reviewing and testing each other's stuff and less time writing new stuff. Maybe on a sufficiently gloomy day I'll actually send it.

Quoted 3 lines
Quoted 1 line

/me sneaks into Andrew's office and sends it out.

Thanks. 8)

Well, is it smart? I mean, it's not stupid of course, but it has its disadvantages which Andrew already mentioned. Less time for writing new stuff. So it is a tradeoff, most likely the reason why he didn't send it yet.

What are the sideeffects of this? Does it repel people? Or controversely, does it bring new people in, who are asked by others to do a little review?

Does it lead to better documented and commented code, to help the review process? Does it lead to worse reviews? Does it stiffle innovation, or, as more ppl work on one patch, does it stimulate it? Will people start to cooperate more, or will they argue and fight when someone refuses to review patches?

Anyway, you can't know these in advance, and watching what it does is the only way to find out. Its Andrew's call, either way.

Days should't be gloomy, but if they do, trying new things is the only way to find a solution. The growing amount of people workin on the kernel and the increasing demands from the users force the kernel community to evolve, and central figures like Andrew and Linus play a big role in this. I think you guys have done a great job until now, and I trust you can keep it that way.

Jos