[PATCH 2/3] Adjust the comment on get_order() to describe the size==0 case

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: David Howells
Date: Friday, March 26, 2010 - 7:42 am

Adjust the comment on get_order() to note that the result of passing a size of
0 results in an undefined value.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 include/asm-generic/getorder.h |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/include/asm-generic/getorder.h b/include/asm-generic/getorder.h
index 67e7245..76e9687 100644
--- a/include/asm-generic/getorder.h
+++ b/include/asm-generic/getorder.h
@@ -5,7 +5,28 @@
 
 #include <linux/compiler.h>
 
-/* Pure 2^n version of get_order */
+/**
+ * get_order - Determine the allocation order of a memory size
+ * @size: The size for which to get the order
+ *
+ * Determine the allocation order of a particular sized block of memory.  This
+ * is on a logarithmic scale, where:
+ *
+ *	0 -> 2^0 * PAGE_SIZE and below
+ *	1 -> 2^1 * PAGE_SIZE to 2^0 * PAGE_SIZE + 1
+ *	2 -> 2^2 * PAGE_SIZE to 2^1 * PAGE_SIZE + 1
+ *	3 -> 2^3 * PAGE_SIZE to 2^2 * PAGE_SIZE + 1
+ *	4 -> 2^4 * PAGE_SIZE to 2^3 * PAGE_SIZE + 1
+ *	...
+ *
+ * The order returned is used to find the smallest allocation granule required
+ * to hold an object of the specified size.
+ *
+ * The result is undefined if the size is 0.
+ *
+ * This function may be used to initialise variables with compile time
+ * evaluations of constants.
+ */
 static inline __attribute_const__ int get_order(unsigned long size)
 {
 	int order;

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 1/3] X86: Optimise fls(), ffs() and fls64(), David Howells, (Fri Mar 26, 7:42 am)
[PATCH 2/3] Adjust the comment on get_order() to describe ..., David Howells, (Fri Mar 26, 7:42 am)
[PATCH 3/3] Optimise get_order(), David Howells, (Fri Mar 26, 7:42 am)
Re: [PATCH 1/3] X86: Optimise fls(), ffs() and fls64(), Linus Torvalds, (Fri Mar 26, 10:23 am)
Re: [PATCH 1/3] X86: Optimise fls(), ffs() and fls64(), Scott Lurndal, (Fri Mar 26, 10:37 am)
Re: [PATCH 1/3] X86: Optimise fls(), ffs() and fls64(), David Howells, (Fri Mar 26, 10:42 am)
Re: [PATCH 1/3] X86: Optimise fls(), ffs() and fls64(), Linus Torvalds, (Fri Mar 26, 10:42 am)
Re: [PATCH 1/3] X86: Optimise fls(), ffs() and fls64(), Linus Torvalds, (Fri Mar 26, 10:45 am)
Re: [PATCH 1/3] X86: Optimise fls(), ffs() and fls64(), Matthew Wilcox, (Fri Mar 26, 10:52 am)
Re: [PATCH 1/3] X86: Optimise fls(), ffs() and fls64(), Ralf Baechle, (Fri Mar 26, 10:58 am)
Re: [PATCH 1/3] X86: Optimise fls(), ffs() and fls64(), Linus Torvalds, (Fri Mar 26, 11:03 am)
Re: [PATCH 1/3] X86: Optimise fls(), ffs() and fls64(), Matthew Wilcox, (Fri Mar 26, 11:16 am)
Re: [PATCH 1/3] X86: Optimise fls(), ffs() and fls64(), Matthew Wilcox, (Tue Apr 6, 6:30 am)
Re: [PATCH 1/3] X86: Optimise fls(), ffs() and fls64(), Jamie Lokier, (Tue Apr 6, 6:57 am)
[No subject], Linus Torvalds, (Tue Apr 6, 7:40 am)
Re: [PATCH 1/3] X86: Optimise fls(), ffs() and fls64(), David Howells, (Wed Apr 14, 4:49 am)
Re: [PATCH 1/3] X86: Optimise fls(), ffs() and fls64(), David Howells, (Wed Apr 14, 6:13 am)
Re: [PATCH 1/3] X86: Optimise fls(), ffs() and fls64(), David Howells, (Thu Apr 15, 1:48 am)
Re: [PATCH 1/3] X86: Optimise fls(), ffs() and fls64(), Jamie Lokier, (Thu Apr 15, 4:41 am)