Forgot your password?
typodupeerror
Data Storage Operating Systems Software Hardware

Is Video RAM a Good Swap Device? 235

Posted by kdawson
from the it's-there-why-not-use-it dept.
sean4u writes "I use a 'lucky' (inexplicably still working) headless desktop PC to serve pages for a low-volume e-commerce site. I came across a gentoo-wiki.com page and this linuxnews.pl page that suggested the interesting possibility of using the Video RAM of the built-in video adapter as a swap device or RAM disk. The instructions worked a treat, but I'm curious as to how good a substitute this can be for swap space on disk. In my (amateurish) test, hdparm -t tells me the Video RAM block device is 3 times slower than the aging disk I currently use. If you've used this technique, what performance do you get? Is the poor performance report from hdparm a feature of the hardware, or the Memory Technology Device driver? What do you use to measure swap performance?"
This discussion has been archived. No new comments can be posted.

Is Video RAM a Good Swap Device?

Comments Filter:
  • by bostons1337 (1025584) on Thursday October 11, 2007 @10:44AM (#20939923)
    This doesn't sound like the most stable thing to do especially if your running a server on the same computer. It sounds good on paper but implementing it is a whole different game. From my years in IT never try anything like this on production servers, thats what test servers are for.
  • by arth1 (260657) on Thursday October 11, 2007 @10:53AM (#20940071) Homepage Journal
    It shouldn't matter, cause AGP is in no circumstance slower than the 33 MHz PCI bus, and you can run a couple of IDE hard drives maxed out on a PCI ATA controller.
  • video RAM (Score:5, Insightful)

    by mcmonkey (96054) on Thursday October 11, 2007 @10:58AM (#20940145) Homepage
    Are you sure the system has video RAM? Doesn't built-in video generally share the system RAM?

  • Short answer: (Score:1, Insightful)

    by Ihlosi (895663) on Thursday October 11, 2007 @10:59AM (#20940159)
    Is video RAM a good swap device

    No.

    It's an interesting hack to use it as such, but in terms of performance you're better off investing in more RAM and a faster HDD.

  • by Corporate Troll (537873) on Thursday October 11, 2007 @11:03AM (#20940211) Homepage Journal

    Video RAM is designed for performance, not for stability. If a bit flips in your video RAM, a pixel is going to be bad or a texture will be slightly different. You're not going to notice.

    A bit flip in your swap space (or main RAM), now that is something you really don't want to happen....

  • by TeknoHog (164938) on Thursday October 11, 2007 @11:11AM (#20940347) Homepage Journal

    Heck, I remember RAM expansion cards for ISA slots. I'm sure this is faster, though I didn't get any meaningful boost when I tried this once. Nevertheless, if you're running headless system, it's better IMHO if you get some use of the display hardware, rather than no use. Even if it's a little slow. You shouldn't rely on swap as a memory expansion anyway, it's just a way to gracefully degrade performance when you hit the limit.

    I think it's also nice to have swap on a different physical device/bus from your main hard drive. Maybe the swap isn't any faster, but at least it isn't slowing down any other hard drive usage.

  • by mikael (484) on Thursday October 11, 2007 @11:26AM (#20940615)
    It will be more than slightly different if one of the most significant bits of any byte is changed in such a way, it may very well be white or black instead of medium gray. Also, VRAM is used for more than just pixel data now. It it also used to store geometry in the form of display lists and executable code for vertex, geometry and pixel shaders. One bit flipped in a floating-point value or in a executable bit of code and it could affect an entire rendered frame.

    Although, I can only imagine the senior engineers at companies at Nvidia raising their hands to their head and screaming "Noooooooo!!!!". I guess that happens when you choose to have one storage device have a faster bus transfer rate than all the others.
  • Re: Trolls (Score:3, Insightful)

    by TheVelvetFlamebait (986083) on Thursday October 11, 2007 @11:35AM (#20940773) Journal

    Why does /. even allow AC posting still?
    What's wrong with them? They're easy to ignore, and they offset the problem with the moderation system, where expressing certain opinions can guarantee you negative karma.

    Besides, Slashdotters have never bought the "why are you running if you have nothing to hide" argument.
  • by Rolman (120909) on Thursday October 11, 2007 @11:42AM (#20940899)
    It's very cool that the memory becomes available so easily with just a couple driver parameters. It's a pity that there's a lot to optimize before it can really shine.

    Memory architecture on a GPU is very different from system memory. Memory there is not linear and the video memory controller will go through a lot of remapping to present it as such, something that's probably very slow because of the VBIOS. Then there's the issue of tuning the bus so that reads and writes are using its full bandwidth, and again a poor VBIOS implementation may be the bottleneck.

    The best but harder solution would be to have a means to program the video memory controller directly to map pages of system memory and do all the copying and moving itself. Of course, this is hardly ever going to happen, but some improvements can still make it into the VBIOS, some of which will probably happen once GPGPU-style programming starts getting more attention as both nVidia and AMD/ATI are seemingly interested in pushing with things like CUDA [nvidia.com] and Stream Computing [amd.com].

    The concept as it is now, however, remains extremely cool. It might still be orders of magnitude slower in terms of latency and throughput compared to system memory, but it should be a lot more responsive than a hard drive just because there are no seek times involved. That said, hdparm -t may not be the best tool for measuring performance, so i'd be more interested in a random access benchmark since it may make some use of the parallel memory architecture inherent on a video card.
  • by Barny (103770) <bakadamage-slashdot@yahoo.com> on Thursday October 11, 2007 @12:21PM (#20941457) Homepage Journal
    Problem is, most people who think the whole "swapping is bad" thing are windows users, an OS that still has a tendency to swap out the most interesting and useful things.

    Swap is great for a server or workstation, once set on a single task it needs never do anything else till shut down, but for a windows PC that could at any time have anything run on it (not to mention a sub-standard disk cache system) having parts swapped out to make room for a disk cache that doesn't do a whole awful lot is less than optimal.

    This is of course the point where you point out that converting all your junk to windows vista and training all your staff to use the new office 2007 "ribbon" is about the same cost as training them to use linux and OOo, the latter being a lot cheaper too :)
  • by OS24Ever (245667) * <trekkie@nomorestars.com> on Thursday October 11, 2007 @12:59PM (#20941973) Homepage Journal
    Neither of the technologies he listed were PCI. VESA came out in the late 80s/early 90s, as did EISA. to the best of my knowledge EISA was never used on video cards unless it was highly specialized. they went from the VESA local bus, to PCI, to AGP and its various speeds, to PCI-E x16.

    I think one of the points of confusion here seems to be that most people don't realize that while something is built into a motherboard it doesn't have some magical interface that makes the bits fly differently than if it was in a slot. I think that is what is attempted to be said by the multiple posts this comment has generated
  • Re:Short answer: (Score:5, Insightful)

    by 644bd346996 (1012333) on Thursday October 11, 2007 @01:27PM (#20942347)
    Which is, of course, a completely useless and disingenuous answer to a person who already has the graphics memory sitting around, and wants to know if it is better than a hard drive.

    You seem to be advocating wasting perfectly good VRAM in favor of buying more system RAM. If the VRAM is essentially free (ie. comes with the system no matter what), there is no good reason not to try to put it to good use.

    Also, your "No" is completely unqualified. You offer no details of how VRAM performs worse as swap space than hard drives, let alone actual benchmarks or citations. (And I have the feeling that most graphics memory would be significantly better than your average IDE hard drive for swapping.)

    Mod parent overrated.
  • by Eponymous Bastard (1143615) on Thursday October 11, 2007 @01:57PM (#20942705)

    Is track zero always at the outer edge?

    I hope so, because that's where I like to keep my swap partition.
    Actually, that's not necessarily optimal. If you were reading a file on the inner edge and get a page fault, the disk will have to do a full seek all the way to the other side to be able to get the page. You're better off putting the page file halfway between the inner and outer edges to lower the average length of your seeks for page faults. Of course, that depends on how much thrashing you're experiencing and how much file access is mixed in with that, so YMMV

    IIRC, NTFS has some of its main data structures in the middle of the partition for that reason.
  • by Mr Z (6791) on Thursday October 11, 2007 @02:55PM (#20943677) Homepage Journal

    If it's lower bandwidth and higher latency than the rest of system memory, then it makes perfect sense to NOT use it as primary storage but as a secondary storage. Currently, swap is the only straightforward mechanism Linux offers for doing so.

Life. Don't talk to me about life. - Marvin the Paranoid Anroid

Working...