Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Oct 2012 19:28:35 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r241750 - head/sys/dev/netmap
Message-ID:  <201210191928.q9JJSZtu061409@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Fri Oct 19 19:28:35 2012
New Revision: 241750
URL: http://svn.freebsd.org/changeset/base/241750

Log:
  Use M_NOWAIT when calling malloc with a lock held.
  
  The check for a NULL return was already in place so I assume this was just
  an oversight.

Modified:
  head/sys/dev/netmap/netmap_mem2.c

Modified: head/sys/dev/netmap/netmap_mem2.c
==============================================================================
--- head/sys/dev/netmap/netmap_mem2.c	Fri Oct 19 19:27:33 2012	(r241749)
+++ head/sys/dev/netmap/netmap_mem2.c	Fri Oct 19 19:28:35 2012	(r241750)
@@ -595,7 +595,7 @@ netmap_finalize_obj_allocator(struct net
 #ifdef linux
 	p->lut = vmalloc(n);
 #else
-	p->lut = malloc(n, M_NETMAP, M_WAITOK | M_ZERO);
+	p->lut = malloc(n, M_NETMAP, M_NOWAIT | M_ZERO);
 #endif
 	if (p->lut == NULL) {
 		D("Unable to create lookup table (%d bytes) for '%s'", n, p->name);
@@ -604,7 +604,7 @@ netmap_finalize_obj_allocator(struct net
 
 	/* Allocate the bitmap */
 	n = (p->objtotal + 31) / 32;
-	p->bitmap = malloc(sizeof(uint32_t) * n, M_NETMAP, M_WAITOK | M_ZERO);
+	p->bitmap = malloc(sizeof(uint32_t) * n, M_NETMAP, M_NOWAIT | M_ZERO);
 	if (p->bitmap == NULL) {
 		D("Unable to create bitmap (%d entries) for allocator '%s'", n,
 		    p->name);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210191928.q9JJSZtu061409>