Re: [PATCH 00/10] MM changes to improve swap-over-NFS support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



NeilBrown <neilb@xxxxxxx> wrote:

> Assorted improvements for swap-via-filesystem.
> 
> This is a resend of these patches, rebased on current HEAD.
> The only substantial changes is that swap_dirty_folio has replaced
> swap_set_page_dirty.
> 
> Currently swap-via-fs (SWP_FS_OPS) doesn't work for any filesystem.  It
> has previously worked for NFS but that broke a few releases back.
> This series changes to use a new ->swap_rw rather than ->readpage and
> ->direct_IO.  It also makes other improvements.
> 
> There is a companion series already in linux-next which fixes various
> issues with NFS.  Once both series land, a final patch is needed which
> changes NFS over to use ->swap_rw.

This seems to work by running sufficient copies of the attached program in
parallel to overwhelm the amount of ordinary RAM.

Tested-by: David Howells <dhowells@xxxxxxxxxx>
---
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/mman.h>

int main()
{
	unsigned int pid = getpid(), iterations = 0;
	size_t i, j, size = 1024 * 1024 * 1024;
	char *p;
	bool mismatch;

	p = malloc(size);
	if (!p) {
		perror("malloc");
		exit(1);
	}

	srand(pid);
	for (i = 0; i < size; i += 4)
		*(unsigned int *)(p + i) = rand();
	
	do {
		for (j = 0; j < 16; j++) {
			for (i = 0; i < size; i += 4096)
				*(unsigned int *)(p + i) += 1;
			iterations++;
		}

		mismatch = false;
		srand(pid);
		for (i = 0; i < size; i += 4) {
			unsigned int r = rand();
			unsigned int v = *(unsigned int *)(p + i);

			if (i % 4096 == 0)
				v -= iterations;

			if (v != r) {
				fprintf(stderr, "mismatch %zx: %x != %x (diff %x)\n",
					i, v, r, v - r);
				mismatch = true;
			}
		}
	} while (!mismatch);

	exit(1);
}





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux