News for hackers. Stuff that matters.
Re:Something is deeply broken in OS X memory management by spudlyo on Monday April 23, 2012 @01:04PM (#3879805)
What really needs to happen is that Spotlight and Time Machine need to use direct i/o (F_NOCACHE) when they read data from the filesystem, this way they won't pollute the disk cache with their reads and OSX won't swap out a bunch of pages in response.

I think you could probably hack something together that does this with DYLD_INSERT_LIBRARIES (OSX's LD_PRELOAD) that would would hook the open system call and fcntl F_NOCACHE on the file descriptor before it hands it back to the application.

Re:Something is deeply broken in OS X memory management by lobster_johnson on Monday April 23, 2012 @02:37PM (#3880268)
This is the correct solution. Time Machine and Spotlight should not pollute the OS cache.
Re:Something is deeply broken in OS X memory management by nirvana on Monday April 23, 2012 @03:15PM (#3880462)
I bet the odds are damn good that neither of them ARE polluting the OS Cache.

That they are is just speculation from someone whose taken his experience and projected it onto everybody.

Since he's a person who mucks around with random system settings (like the one in his article) there's no telling what previous damage he's done to cause this problem.

Re:Something is deeply broken in OS X memory management by spudlyo on Monday April 23, 2012 @03:58PM (#3880650)
You might be right. In my testing, mdworker and friends behave like you'd want them to, I don't see them polluting the cache on my Lion machine. Haven't tried time machine yet.

EDIT: I can't get either spotlight or time machine to show any cache polluting behavior at all, at least not in the way that I run them. I used "mdutil -E /" to force a re-index of my disk, and I kicked off an initial time machine backup on a secondary drive I had lying around. I see both backupd and mdworker doing a lot of disk reads using iotop, but top shows my inactive memory not really changing as drastically as I'd expect, like if I were to cat a giant file to /dev/null.

Re:Something is deeply broken in OS X memory management by syncopate on Monday April 23, 2012 @04:07PM (#3880686)
For Linux, there is a program called nocache, which does something similar to this:

https://github.com/Feh/nocache

Re:Something is deeply broken in OS X memory management by reddit_clone on Monday April 23, 2012 @03:33PM (#3880550)
This is an excellent suggestion that might actually solve whole lot of these issues.

I hope Apple engineers are looking at this thread.