Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/riastradh-drm2]: src/sys/external/bsd/drm2/include/linux Make Linux kmal...
details: https://anonhg.NetBSD.org/src/rev/3364c272b290
branches: riastradh-drm2
changeset: 788608:3364c272b290
user: riastradh <riastradh%NetBSD.org@localhost>
date: Tue Jan 21 20:49:10 2014 +0000
description:
Make Linux kmalloc handle a few more gfp flags.
diffstat:
sys/external/bsd/drm2/include/linux/slab.h | 34 ++++++++++++++++++++++-------
1 files changed, 26 insertions(+), 8 deletions(-)
diffs (51 lines):
diff -r fe69d81ac944 -r 3364c272b290 sys/external/bsd/drm2/include/linux/slab.h
--- a/sys/external/bsd/drm2/include/linux/slab.h Tue Jan 21 20:49:01 2014 +0000
+++ b/sys/external/bsd/drm2/include/linux/slab.h Tue Jan 21 20:49:10 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: slab.h,v 1.1.2.9 2013/12/30 04:51:24 riastradh Exp $ */
+/* $NetBSD: slab.h,v 1.1.2.10 2014/01/21 20:49:10 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -47,16 +47,34 @@
{
int flags = 0;
- /* XXX Handle other cases as they arise. */
- KASSERT((gfp == GFP_ATOMIC) || (gfp == GFP_KERNEL));
+ /* This has no meaning to us. */
+ gfp &= ~__GFP_NOWARN;
+
+ /* Pretend this was the same as not passing __GFP_WAIT. */
+ if (ISSET(gfp, __GFP_NORETRY)) {
+ gfp &= ~__GFP_NORETRY;
+ gfp &= ~__GFP_WAIT;
+ }
- if (ISSET(gfp, __GFP_WAIT))
+ if (ISSET(gfp, __GFP_ZERO)) {
+ flags |= M_ZERO;
+ gfp &= ~__GFP_ZERO;
+ }
+
+ /*
+ * XXX Handle other cases as they arise -- prefer to fail early
+ * rather than allocate memory without respecting parameters we
+ * don't understand.
+ */
+ KASSERT((gfp == GFP_ATOMIC) ||
+ ((gfp & ~__GFP_WAIT) == (GFP_KERNEL & ~__GFP_WAIT)));
+
+ if (ISSET(gfp, __GFP_WAIT)) {
flags |= M_WAITOK;
- else
+ gfp &= ~__GFP_WAIT;
+ } else {
flags |= M_NOWAIT;
-
- if (ISSET(gfp, __GFP_ZERO))
- flags |= M_ZERO;
+ }
return flags;
}
Home |
Main Index |
Thread Index |
Old Index