Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 702

kernel-2.6.18-238.el5.src.rpm

From: Milan Broz <mbroz@redhat.com>
Date: Mon, 23 Jun 2008 19:30:09 +0200
Subject: [dm] snapshot: reduce default memory allocation
Message-id: 485FDDA1.9040601@redhat.com
O-Subject: [RHEL 5.3 PATCH] dm: snapshot: reduce default memory allocation (rhbz#436494)
Bugzilla: 436494
RH-Acked-by: Alasdair G Kergon <agk@redhat.com>
RH-Acked-by: Jeff Moyer <jmoyer@redhat.com>

RHEL5.3 dm: snapshot: reduce default memory allocation
Resolves: rhbz#436494

Patch is upstream, commit 8ee2767a5903fde549fd3597690f64c8d951051a

Limit the amount of memory allocated per snapshot on systems
with a large page size.  (The larger default chunk size on
these systems compensates for the smaller number of pages reserved.)

This unballanced memory allocation caused OOM unnecesarily.

Kernel with patch compiled and tested.

diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 267ffe8..1a33aea 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -35,9 +35,9 @@
 #define SNAPSHOT_COPY_PRIORITY 2
 
 /*
- * Each snapshot reserves this many pages for io
+ * Reserve 1MB for each snapshot initially (with minimum of 1 page).
  */
-#define SNAPSHOT_PAGES 256
+#define SNAPSHOT_PAGES (((1UL << 20) >> PAGE_SHIFT) ? : 1)
 
 struct workqueue_struct *ksnapd;
 static void flush_queued_bios(void *data);