Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757937AbbGGPNh (ORCPT ); Tue, 7 Jul 2015 11:13:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44696 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757458AbbGGPNS (ORCPT ); Tue, 7 Jul 2015 11:13:18 -0400 Date: Tue, 7 Jul 2015 11:13:17 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Mike Snitzer cc: "Alasdair G. Kergon" , Edward Thornber , Andrew Morton , David Rientjes , Vivek Goyal , linux-kernel@vger.kernel.org, linux-mm@kvack.org, dm-devel@redhat.com Subject: [PATCH 7/7] dm: make dm_vcalloc use kvmalloc In-Reply-To: Message-ID: References: User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2740 Lines: 83 Make dm_vcalloc use kvmalloc, so that smaller allocations are done with kmalloc (which is faster). Signed-off-by: Mikulas Patocka --- drivers/md/dm-snap-persistent.c | 2 +- drivers/md/dm-snap.c | 2 +- drivers/md/dm-table.c | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) Index: linux-4.2-rc1/drivers/md/dm-snap-persistent.c =================================================================== --- linux-4.2-rc1.orig/drivers/md/dm-snap-persistent.c 2015-07-07 15:50:23.000000000 +0200 +++ linux-4.2-rc1/drivers/md/dm-snap-persistent.c 2015-07-07 15:59:43.000000000 +0200 @@ -600,7 +600,7 @@ static void persistent_dtr(struct dm_exc free_area(ps); /* Allocated in persistent_read_metadata */ - vfree(ps->callbacks); + kvfree(ps->callbacks); kfree(ps); } Index: linux-4.2-rc1/drivers/md/dm-snap.c =================================================================== --- linux-4.2-rc1.orig/drivers/md/dm-snap.c 2015-07-07 15:50:23.000000000 +0200 +++ linux-4.2-rc1/drivers/md/dm-snap.c 2015-07-07 15:59:43.000000000 +0200 @@ -633,7 +633,7 @@ static void dm_exception_table_exit(stru kmem_cache_free(mem, ex); } - vfree(et->table); + kvfree(et->table); } static uint32_t exception_hash(struct dm_exception_table *et, chunk_t chunk) Index: linux-4.2-rc1/drivers/md/dm-table.c =================================================================== --- linux-4.2-rc1.orig/drivers/md/dm-table.c 2015-07-07 15:50:25.000000000 +0200 +++ linux-4.2-rc1/drivers/md/dm-table.c 2015-07-07 15:59:43.000000000 +0200 @@ -143,7 +143,7 @@ void *dm_vcalloc(unsigned long nmemb, un return NULL; size = nmemb * elem_size; - addr = vzalloc(size); + addr = kvmalloc(size, GFP_KERNEL | __GFP_ZERO); return addr; } @@ -171,7 +171,7 @@ static int alloc_targets(struct dm_table n_targets = (struct dm_target *) (n_highs + num); memset(n_highs, -1, sizeof(*n_highs) * num); - vfree(t->highs); + kvfree(t->highs); t->num_allocated = num; t->highs = n_highs; @@ -235,7 +235,7 @@ void dm_table_destroy(struct dm_table *t /* free the indexes */ if (t->depth >= 2) - vfree(t->index[t->depth - 2]); + kvfree(t->index[t->depth - 2]); /* free the targets */ for (i = 0; i < t->num_targets; i++) { @@ -247,7 +247,7 @@ void dm_table_destroy(struct dm_table *t dm_put_target_type(tgt->type); } - vfree(t->highs); + kvfree(t->highs); /* free the device list */ free_devices(&t->devices, t->md); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/