lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080307091326.0AC3A1B419C@basil.firstfloor.org>
Date:	Fri,  7 Mar 2008 10:13:26 +0100 (CET)
From:	Andi Kleen <andi@...stfloor.org>
To:	axboe@...nel.dk, linux-kernel@...r.kernel.org
Subject: [PATCH] [5/7] Convert the blk allocator functions over to the mask allocator


This is a separate patch because the block allocator functions are 
only getting introduced by my earlier SCSI DMA cleanup patch kit.
This means this patch alone relies on them. Without that patchkit
applied earlier it can be safely dropped.

Right now blk_kmalloc rounds up to pages. There are only a few callers
so adding a sub allocator for that doesn't seem worthwhile.

Signed-off-by: Andi Kleen <ak@...e.de>

---
 block/blk-settings.c   |    7 +++++--
 include/linux/blkdev.h |    4 ++--
 2 files changed, 7 insertions(+), 4 deletions(-)

Index: linux/include/linux/blkdev.h
===================================================================
--- linux.orig/include/linux/blkdev.h
+++ linux/include/linux/blkdev.h
@@ -560,12 +560,12 @@ extern struct page *blk_alloc_pages(stru
 extern void *blk_kmalloc(struct request_queue *q, unsigned size, gfp_t gfp);
 static inline void blk_free_pages(struct page *p, int size)
 {
-	__free_pages(p, get_order(size));
+	__free_pages_mask(p, size);
 }
 
 static inline void blk_kfree(void *p, int size)
 {
-	kfree(p);
+	free_pages_mask(p, size);
 }
 
 struct req_iterator {
Index: linux/block/blk-settings.c
===================================================================
--- linux.orig/block/blk-settings.c
+++ linux/block/blk-settings.c
@@ -159,13 +159,16 @@ EXPORT_SYMBOL(blk_queue_bounce_limit);
 struct page *blk_alloc_pages(struct request_queue *q,
 				   gfp_t gfp, int size)
 {
-	return alloc_pages((q->bounce_gfp & ~GFP_NOIO) | gfp, get_order(size));
+	return alloc_pages_mask(gfp, size, blk_q_mask(q));
 }
 EXPORT_SYMBOL(blk_alloc_pages);
 
 void *blk_kmalloc(struct request_queue *q, unsigned size, gfp_t gfp)
 {
-	return kmalloc(size, gfp | (q->bounce_gfp & ~GFP_NOIO));
+	/* Right now gets pages. That is ok for the few callers. Later
+	 * might need to use a sub allocator.
+	 */
+	return get_pages_mask(gfp, size, blk_q_mask(q));
 }
 EXPORT_SYMBOL(blk_kmalloc);
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ