December 2008 Archives

Which is faster, a swap file or a swap partition?

This is a question that comes up on a fairly regular basis on IRC chatrooms, mailing lists, etc. which has widely varying answers depending on the source.

While updating our courseware a few days back, I decided to start digging into the issue and found a couple of very interesting reads.

The most common claim is that a swap partition is faster than a swap
file because in older versions of the Linux kernel experienced some filesystem overhead when accessing the swap file.

Ever since the release of 2.5.23 of the Linux kernel, however, this is no longer the case.
http://www.kernel.org/pub/linux/kernel/v2.5/ChangeLog-2.5.23
(search for the line: "[PATCH] direct-to-BIO I/O for swapcache pages")

In case the highly-technical explanation of how swap files are now handled is less-than-enlightening, perhaps a description from number two Linux kernel developer himself (Andrew Morton) can help clear the muddy waters:
http://lkml.org/lkml/2005/7/7/326

I still haven't had time to come up with and perform any decent performance comparison, so for now I'll take Andrew Morton's word for it...
In case anyone is wondering why their fingerprint reader isn't working under Linux after a recent upgrade, I may have an answer for a portion of you.
_If_ you happen to use the thinkfinger PAM module to authenticate and you've upgraded hal to version 0.5.11, a carriage return is now necessary *after* scanning your finger. The reason, as described in the bug report is that: 'When creating a uinput device with only one key, hal incorrectly assigns it as a "button" rather than a "keyboard".'
They're still working on a solution, but a temporary workaround (and perhaps the final solution) is to apply this patch and rebuild/reinstall hal:

diff -ur hal-0.5.11.old/hald/linux/device.c hal-0.5.11.new/hald/linux/device.c
--- hal-0.5.11.old/hald/linux/device.c 2008-05-07 19:23:42.000000000 -0400
+++ hal-0.5.11.new/hald/linux/device.c 2008-11-05 18:26:33.000000000 -0500
@@ -175,7 +175,7 @@
{
char *s;
long bitmask[NBITS(KEY_MAX)];
- int num_bits;
+ int num_bits, bus_type;

s = hal_util_get_string_from_file (sysfs_path, "capabilities/key");
if (s == NULL)
@@ -183,11 +183,11 @@

num_bits = input_str_to_bitmask (s, bitmask, sizeof (bitmask));

- if (num_bits == 1) {
- /* this is for input devices originating from the ACPI layer et. al. */
-
- /* TODO: potentially test for BUS_HOST */
+ if (!hal_util_get_int_from_file (sysfs_path, "id/bustype", &bus_type, 16))
+ goto out;

+ if (num_bits == 1 && bus_type == BUS_HOST) {
+ /* this is for input devices originating from the ACPI layer et. al. */
hal_device_add_capability (d, "button");
hal_device_property_set_bool (d, "button.has_state", FALSE);
if (test_bit (KEY_POWER, bitmask)) {

About this Archive

This page is an archive of entries from December 2008 listed from newest to oldest.

November 2008 is the previous archive.

March 2009 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Categories

Pages

OpenID accepted here Learn more about OpenID
Powered by Movable Type 4.24-en