linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] dm log userspace: use mempool_create_kmalloc_pool()
@ 2015-03-08  0:43 David Rientjes
  2015-03-11 12:58 ` Mike Snitzer
  0 siblings, 1 reply; 3+ messages in thread
From: David Rientjes @ 2015-03-08  0:43 UTC (permalink / raw)
  To: Alasdair Kergon, Mike Snitzer
  Cc: Neil Brown, linux-kernel, linux-raid, dm-devel

Mempools created for kmalloc caches should use
mempool_create_kmalloc_pool().

Cc: Alasdair Kergon <agk@redhat.com>
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: Neil Brown <neilb@suse.de>
Signed-off-by: David Rientjes <rientjes@google.com>
---
 drivers/md/dm-log-userspace-base.c | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/md/dm-log-userspace-base.c b/drivers/md/dm-log-userspace-base.c
--- a/drivers/md/dm-log-userspace-base.c
+++ b/drivers/md/dm-log-userspace-base.c
@@ -74,18 +74,6 @@ struct log_c {
 	uint32_t integrated_flush;
 };
 
-static mempool_t *flush_entry_pool;
-
-static void *flush_entry_alloc(gfp_t gfp_mask, void *pool_data)
-{
-	return kmalloc(sizeof(struct flush_entry), gfp_mask);
-}
-
-static void flush_entry_free(void *element, void *pool_data)
-{
-	kfree(element);
-}
-
 static int userspace_do_request(struct log_c *lc, const char *uuid,
 				int request_type, char *data, size_t data_size,
 				char *rdata, size_t *rdata_size)
@@ -537,6 +525,8 @@ static int flush_by_group(struct log_c *lc, struct list_head *flush_list,
 	return r;
 }
 
+static mempool_t *flush_entry_pool;
+
 /*
  * userspace_flush
  *
@@ -886,9 +876,8 @@ static int __init userspace_dirty_log_init(void)
 {
 	int r = 0;
 
-	flush_entry_pool = mempool_create(100, flush_entry_alloc,
-					  flush_entry_free, NULL);
-
+	flush_entry_pool = mempool_create_kmalloc_pool(100,
+						sizeof(struct flush_entry));
 	if (!flush_entry_pool) {
 		DMWARN("Unable to create flush_entry_pool:  No memory.");
 		return -ENOMEM;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: dm log userspace: use mempool_create_kmalloc_pool()
  2015-03-08  0:43 [patch] dm log userspace: use mempool_create_kmalloc_pool() David Rientjes
@ 2015-03-11 12:58 ` Mike Snitzer
  2015-03-18 22:30   ` Mike Snitzer
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Snitzer @ 2015-03-11 12:58 UTC (permalink / raw)
  To: David Rientjes
  Cc: Alasdair Kergon, Neil Brown, linux-kernel, linux-raid, dm-devel

On Sat, Mar 07 2015 at  7:43pm -0500,
David Rientjes <rientjes@google.com> wrote:

> Mempools created for kmalloc caches should use
> mempool_create_kmalloc_pool().
> 
> Cc: Alasdair Kergon <agk@redhat.com>
> Cc: Mike Snitzer <snitzer@redhat.com>
> Cc: Neil Brown <neilb@suse.de>
> Signed-off-by: David Rientjes <rientjes@google.com>

Thanks David, I'll get this queued up.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: dm log userspace: use mempool_create_kmalloc_pool()
  2015-03-11 12:58 ` Mike Snitzer
@ 2015-03-18 22:30   ` Mike Snitzer
  0 siblings, 0 replies; 3+ messages in thread
From: Mike Snitzer @ 2015-03-18 22:30 UTC (permalink / raw)
  To: David Rientjes
  Cc: Alasdair Kergon, Neil Brown, linux-kernel, linux-raid, dm-devel

On Wed, Mar 11 2015 at  8:58am -0400,
Mike Snitzer <snitzer@redhat.com> wrote:

> On Sat, Mar 07 2015 at  7:43pm -0500,
> David Rientjes <rientjes@google.com> wrote:
> 
> > Mempools created for kmalloc caches should use
> > mempool_create_kmalloc_pool().
> > 
> > Cc: Alasdair Kergon <agk@redhat.com>
> > Cc: Mike Snitzer <snitzer@redhat.com>
> > Cc: Neil Brown <neilb@suse.de>
> > Signed-off-by: David Rientjes <rientjes@google.com>
> 
> Thanks David, I'll get this queued up.

Turns out I already fixed this a different way about a month ago and
staged it for 4.1, see:
https://git.kernel.org/cgit/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=for-next&id=db57216e710ea5c517f1030fafe7eb21ac938dc5

You'll be interested to note this portion of that commit's header:
"This _should_ eliminate DM's need for io_schedule_timeout() in
mempool_alloc(); so io_schedule() should be sufficient now."

I'll defer to you on whether you'd like to pursue switching to
io_schedule() in mempool_alloc().

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-18 22:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-08  0:43 [patch] dm log userspace: use mempool_create_kmalloc_pool() David Rientjes
2015-03-11 12:58 ` Mike Snitzer
2015-03-18 22:30   ` Mike Snitzer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).