]> git.hungrycats.org Git - linux/commit
[PATCH] swap speedups and fix
authorAndrew Morton <akpm@osdl.org>
Fri, 14 May 2004 12:43:39 +0000 (05:43 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Fri, 14 May 2004 12:43:39 +0000 (05:43 -0700)
commit2e27bd98812fd2f07999574564bd8ce7ddfb4b9e
tree5a4789be5a5be6b01659878bb1c2f1b280015873
parent4e36c1187923a30df09227412a64636cf5dea634
[PATCH] swap speedups and fix

From: Andrea Arcangeli <andrea@suse.de>

I don't think we need an install_swap_bdev/remove_swap_bdev anymore, we should
use the swap_info->bdev, not the swap_bdevs.  the swap_info already has a
->bdev field, the only point of remove_swap_bdev/install_swap_bdev was to
unplug all devices as efficiently as possible, we don't need that anymore with
the page parameter.

Plus the semaphore should be a rwsem to allow parallel unplug from multiple
pages.

After that I don't need to take the semaphore anymore during swapon, no
swapcache with swp_type() pointing to such bdev, will be allowed until swapon
is complete (SWP_ACTIVE is set a lot later after setting p->bdev).

In swapoff I only need a dummy serialization with the readers, after
try_to_unuse is complete:

  err = try_to_unuse(type);
  current->flags &= ~PF_SWAPOFF;

  /* wait for any unplug function to finish */
  down_write(&swap_unplug_sem);
  up_write(&swap_unplug_sem);

that's all, no other locking and no install_swap_bdev/remove_swap_bdev.

(and the swap_bdevs[] compression code was busted)
mm/swapfile.c