From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alasdair G Kergon Subject: Re: [PATCH] raid1: use __GFP_NOFAIL Date: Fri, 1 May 2009 00:14:43 +0100 Message-ID: <20090430231443.GD23302@agk.fab.redhat.com> References: Reply-To: device-mapper development Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com To: Mikulas Patocka Cc: Heinz Mauelshagen , dm-devel@redhat.com List-Id: dm-devel.ids On Mon, Apr 27, 2009 at 07:01:22AM -0400, Mikulas Patocka wrote: > This is a bug I found when implementing the barriers. There should be > __GFP_NOFAIL if the code can't handle an allocation failure. See also this one: dm-raid1-mempool-bug-workaround-reversion.patch Has the original reason for that workaround gone away now or is that mempool still being used incorrectly? Alasdair From: Alasdair G Kergon Implement private fallback if immediate allocation from mempool fails. Standard mempool_alloc() fallback can yield a deadlock when only the calling process is able to refill the pool. In out-of-memory situations, instead of waiting for itself, kmirrord now waits for someone else to free some space, using a standard blocking allocation. Signed-off-by: Daniel Kobras Signed-off-by: Alasdair G Kergon --- [AGK - This patch reverses the mempool workaround described above.] drivers/md/dm-raid1.c | 4 +--- 1 files changed, 1 insertion(+), 3 deletions(-) Index: linux-2.6.19/drivers/md/dm-raid1.c =================================================================== --- linux-2.6.19.orig/drivers/md/dm-raid1.c 2006-12-06 20:49:41.000000000 +0000 +++ linux-2.6.19/drivers/md/dm-raid1.c 2006-12-06 20:49:44.000000000 +0000 @@ -261,9 +261,7 @@ static struct region *__rh_alloc(struct struct region *reg, *nreg; read_unlock(&rh->hash_lock); - nreg = mempool_alloc(rh->region_pool, GFP_ATOMIC); - if (unlikely(!nreg)) - nreg = kmalloc(sizeof(struct region), GFP_NOIO); + nreg = mempool_alloc(rh->region_pool, GFP_NOIO); nreg->state = rh->log->type->in_sync(rh->log, region, 1) ? RH_CLEAN : RH_NOSYNC; nreg->rh = rh;