linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gfp_t
@ 2002-09-26  4:35 Rusty Russell
  2002-09-26 18:59 ` Rasmus Andersen
  0 siblings, 1 reply; 7+ messages in thread
From: Rusty Russell @ 2002-09-26  4:35 UTC (permalink / raw)
  To: mingo, davem; +Cc: torvalds, linux-kernel, Jens Axboe

[-- Attachment #1: Type: text/plain, Size: 811 bytes --]

This creates a mythical gfp_t for passing gfp states, and conversion
macros __GFP() and __UNGFP(), to give warnings, It's 55k, so
compressed and attached.

[Jens, bio_alloc() has the args reversed from normal (Grrr!)]

It's worse than I'd hoped, better than I feared.  I didn't find any
bugs (but then I didn't try compiling with "allyesconfig").

Notes:
o People use GFP_KERNEL instead of SLAB_KERNEL for kmem_cache_alloc,
  so I changed the slab types too.

o If we really want to do this, maybe introduce gfp_t as a typedef to
  int, and use it in all the interfaces first, then change the
  definition later.

BTW, I'm leaving in a couple of hours, so I'm leaving this here for
someone else to get enthusiastic about 8)

Cheers,
Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.


[-- Attachment #2: gfp_t safety patch --]
[-- Type: application/octet-stream, Size: 13993 bytes --]

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

* Re: [PATCH] gfp_t
  2002-09-26  4:35 [PATCH] gfp_t Rusty Russell
@ 2002-09-26 18:59 ` Rasmus Andersen
  2002-09-26 19:29   ` Rasmus Andersen
  0 siblings, 1 reply; 7+ messages in thread
From: Rasmus Andersen @ 2002-09-26 18:59 UTC (permalink / raw)
  To: Rusty Russell; +Cc: mingo, davem, torvalds, linux-kernel, Jens Axboe

[-- Attachment #1: Type: text/plain, Size: 562 bytes --]

On Thu, Sep 26, 2002 at 02:35:30PM +1000, Rusty Russell wrote:
> This creates a mythical gfp_t for passing gfp states, and conversion
> macros __GFP() and __UNGFP(), to give warnings, It's 55k, so
> compressed and attached.

This breaks ntfs/malloc.h which is doing the following:
49:       return __vmalloc(size, GFP_NOFS | __GFP_HIGHMEM, PAGE_KERNEL);

This turns into 
	
          return __vmalloc(size, ((struct gfp_arg *)(0x10 | 0x40 |
		0x80)) | 0x02, ((pgprot_t) { (__PAGE_KERNEL) } ));
		
which '|' is not happy with.

Regards,
  Rasmus

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

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

* Re: [PATCH] gfp_t
  2002-09-26 18:59 ` Rasmus Andersen
@ 2002-09-26 19:29   ` Rasmus Andersen
  2002-09-26 21:15     ` Rasmus Andersen
  0 siblings, 1 reply; 7+ messages in thread
From: Rasmus Andersen @ 2002-09-26 19:29 UTC (permalink / raw)
  To: Rusty Russell; +Cc: mingo, davem, torvalds, linux-kernel, Jens Axboe

[-- Attachment #1: Type: text/plain, Size: 1703 bytes --]

On Thu, Sep 26, 2002 at 08:59:24PM +0200, Rasmus Andersen wrote:
> On Thu, Sep 26, 2002 at 02:35:30PM +1000, Rusty Russell wrote:
> > This creates a mythical gfp_t for passing gfp states, and conversion
> > macros __GFP() and __UNGFP(), to give warnings, It's 55k, so
> > compressed and attached.
> 
> This breaks ntfs/malloc.h which is doing the following:
> 49:       return __vmalloc(size, GFP_NOFS | __GFP_HIGHMEM, PAGE_KERNEL);
[...]

After having had a bit more caffeine, I guess I would like to
change my previous mail to: These two patches for mm/numa.c and
ntfs/malloc.h needs to be in your patchset as well.

--- linux-2.5.38/mm/numa.c	Sun Sep 22 06:25:17 2002
+++ /home/rasmus/transport/linux-2.5.38/mm/numa.c	Thu Sep 26 21:18:59 2002
@@ -42,10 +42,10 @@
 
 #endif /* !CONFIG_DISCONTIGMEM */
 
-struct page * alloc_pages_node(int nid, unsigned int gfp_mask, unsigned int order)
+struct page * alloc_pages_node(int nid, gfp_t gfp_mask, unsigned int order)
 {
 #ifdef CONFIG_NUMA
-	return __alloc_pages(gfp_mask, order, NODE_DATA(nid)->node_zonelists + (gfp_mask & GFP_ZONEMASK));
+	return __alloc_pages(gfp_mask, order, NODE_DATA(nid)->node_zonelists + (__UNGFP(gfp_mask) & GFP_ZONEMASK));
 #else
 	return alloc_pages(gfp_mask, order);
 #endif


--- linux-2.5.38/fs/ntfs/malloc.h	Sun Sep 22 06:25:01 2002
+++ /home/rasmus/transport/linux-2.5.38/fs/ntfs/malloc.h	Thu Sep 26 21:15:55 2002
@@ -46,7 +46,7 @@
 		BUG();
 	}
 	if (likely(size >> PAGE_SHIFT < num_physpages))
-		return __vmalloc(size, GFP_NOFS | __GFP_HIGHMEM, PAGE_KERNEL);
+		return __vmalloc(size, gfp_sub(GFP_NOFS, __GFP_HIGHMEM), PAGE_KERNEL);
 	return NULL;
 }
 

Regards,
  Rasmus

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

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

* Re: [PATCH] gfp_t
  2002-09-26 19:29   ` Rasmus Andersen
@ 2002-09-26 21:15     ` Rasmus Andersen
  2002-10-15 23:10       ` Rusty Russell
  0 siblings, 1 reply; 7+ messages in thread
From: Rasmus Andersen @ 2002-09-26 21:15 UTC (permalink / raw)
  To: Rusty Russell; +Cc: mingo, davem, torvalds, linux-kernel, Jens Axboe

[-- Attachment #1: Type: text/plain, Size: 1997 bytes --]

On Thu, Sep 26, 2002 at 09:29:32PM +0200, Rasmus Andersen wrote:
> On Thu, Sep 26, 2002 at 08:59:24PM +0200, Rasmus Andersen wrote:
> > On Thu, Sep 26, 2002 at 02:35:30PM +1000, Rusty Russell wrote:
> > > This creates a mythical gfp_t for passing gfp states, and conversion
> > > macros __GFP() and __UNGFP(), to give warnings, It's 55k, so
> > > compressed and attached.
> > 
> > This breaks ntfs/malloc.h which is doing the following:
> > 49:       return __vmalloc(size, GFP_NOFS | __GFP_HIGHMEM, PAGE_KERNEL);
> [...]
> 
> After having had a bit more caffeine, I guess I would like to
> change my previous mail to: These two patches for mm/numa.c and
> ntfs/malloc.h needs to be in your patchset as well.

Another one:


--- linux-2.5.38/drivers/char/synclink.c	Sun Sep 22 06:25:06 2002
+++ linux-2.5.38-gfp/drivers/char/synclink.c	Thu Sep 26 23:01:57 2002
@@ -3975,7 +3975,7 @@
 		/* inspect portions of the buffer while other portions are being */
 		/* updated by the adapter using Bus Master DMA. */
 
-		info->buffer_list = kmalloc(BUFFERLISTSIZE, GFP_KERNEL | GFP_DMA);
+		info->buffer_list = kmalloc(BUFFERLISTSIZE, gfp_sub(GFP_KERNEL, __UNGFP(GFP_DMA)));
 		if ( info->buffer_list == NULL )
 			return -ENOMEM;
 			
@@ -4087,7 +4087,7 @@
 		} else {
 			/* ISA adapter uses system memory. */
 			BufferList[i].virt_addr = 
-				kmalloc(DMABUFFERSIZE, GFP_KERNEL | GFP_DMA);
+				kmalloc(DMABUFFERSIZE, gfp_sub(GFP_KERNEL, __UNGFP(GFP_DMA)));
 			if ( BufferList[i].virt_addr == NULL )
 				return -ENOMEM;
 			phys_addr = isa_virt_to_bus(BufferList[i].virt_addr);
@@ -4159,7 +4159,7 @@
  */
 int mgsl_alloc_intermediate_rxbuffer_memory(struct mgsl_struct *info)
 {
-	info->intermediate_rxbuffer = kmalloc(info->max_frame_size, GFP_KERNEL | GFP_DMA);
+	info->intermediate_rxbuffer = kmalloc(info->max_frame_size, gfp_sub(GFP_KERNEL, __UNGFP(GFP_DMA)));
 	if ( info->intermediate_rxbuffer == NULL )
 		return -ENOMEM;
 
Regards,
  Rasmus

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

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

* Re: [PATCH] gfp_t
  2002-09-26 21:15     ` Rasmus Andersen
@ 2002-10-15 23:10       ` Rusty Russell
  2002-10-16  2:14         ` David S. Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Rusty Russell @ 2002-10-15 23:10 UTC (permalink / raw)
  To: Rasmus Andersen; +Cc: mingo, davem, torvalds, linux-kernel, Jens Axboe

In message <20020926211505.GE1892@jaquet.dk> you write:
> > After having had a bit more caffeine, I guess I would like to
> > change my previous mail to: These two patches for mm/numa.c and
> > ntfs/malloc.h needs to be in your patchset as well.
> 
> Another one:

Thanks, both added.  The patch is unlikely to go anywhere unless
someone champions it though.

Cheers,
Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

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

* Re: [PATCH] gfp_t
  2002-10-15 23:10       ` Rusty Russell
@ 2002-10-16  2:14         ` David S. Miller
  2002-10-17  6:40           ` Rusty Russell
  0 siblings, 1 reply; 7+ messages in thread
From: David S. Miller @ 2002-10-16  2:14 UTC (permalink / raw)
  To: rusty; +Cc: rasmus, mingo, torvalds, linux-kernel, axboe

   From: Rusty Russell <rusty@rustcorp.com.au>
   Date: Wed, 16 Oct 2002 09:10:17 +1000
   
   Thanks, both added.  The patch is unlikely to go anywhere unless
   someone champions it though.

Please post the current state of the patch so that this might be
possible :-)

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

* Re: [PATCH] gfp_t
  2002-10-16  2:14         ` David S. Miller
@ 2002-10-17  6:40           ` Rusty Russell
  0 siblings, 0 replies; 7+ messages in thread
From: Rusty Russell @ 2002-10-17  6:40 UTC (permalink / raw)
  To: David S. Miller; +Cc: rasmus, mingo, torvalds, linux-kernel, axboe

[-- Attachment #1: Type: text/plain, Size: 573 bytes --]

In message <20021015.191439.20524174.davem@redhat.com> you write:
>    From: Rusty Russell <rusty@rustcorp.com.au>
>    Date: Wed, 16 Oct 2002 09:10:17 +1000
>    
>    Thanks, both added.  The patch is unlikely to go anywhere unless
>    someone champions it though.
> 
> Please post the current state of the patch so that this might be
> possible :-)

Oh, OK.  It's on my kernel.org web page with all my other patches, of
course, but updated and included here for wider audience.

Compiles...
Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.


[-- Attachment #2: gfp_t patch for 2.5.43 --]
[-- Type: application/octet-stream, Size: 15966 bytes --]

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

end of thread, other threads:[~2002-10-17  7:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-26  4:35 [PATCH] gfp_t Rusty Russell
2002-09-26 18:59 ` Rasmus Andersen
2002-09-26 19:29   ` Rasmus Andersen
2002-09-26 21:15     ` Rasmus Andersen
2002-10-15 23:10       ` Rusty Russell
2002-10-16  2:14         ` David S. Miller
2002-10-17  6:40           ` Rusty Russell

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).