From: David Howells <dhowells@redhat.com>
To: torvalds@osdl.org, mingo@elte.hu, tglx@linutronix.de
Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org,
David Howells <dhowells@redhat.com>
Subject: [PATCH 2/3] Adjust the comment on get_order() to describe the size==0 case
Date: Fri, 26 Mar 2010 14:42:46 +0000 [thread overview]
Message-ID: <20100326144246.8583.24462.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <20100326144241.8583.95617.stgit@warthog.procyon.org.uk>
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;
next prev parent reply other threads:[~2010-03-26 14:43 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4BACCB4E.7010108@draigBrady.com>
2010-03-26 14:42 ` [PATCH 1/3] X86: Optimise fls(), ffs() and fls64() David Howells
2010-03-26 14:42 ` David Howells [this message]
2010-03-26 14:42 ` [PATCH 3/3] Optimise get_order() David Howells
2010-03-26 14:42 ` David Howells
2010-03-26 17:23 ` [PATCH 1/3] X86: Optimise fls(), ffs() and fls64() Linus Torvalds
2010-03-26 17:37 ` Scott Lurndal
2010-03-26 17:42 ` Linus Torvalds
2010-04-06 13:57 ` Jamie Lokier
2010-04-06 14:40 ` Linus Torvalds
2010-03-26 17:42 ` David Howells
2010-03-26 17:45 ` Linus Torvalds
2010-03-26 17:58 ` Ralf Baechle
2010-03-26 18:03 ` Linus Torvalds
2010-03-26 18:16 ` Matthew Wilcox
2010-04-06 13:30 ` Matthew Wilcox
2010-04-14 11:49 ` David Howells
2010-04-14 14:30 ` Avi Kivity
2010-04-15 8:48 ` David Howells
2010-04-15 8:49 ` Avi Kivity
2010-04-15 11:41 ` Jamie Lokier
2010-03-26 17:52 ` Matthew Wilcox
2010-04-14 13:13 ` David Howells
2011-12-13 14:56 [PATCH 1/3] X86_64: " David Howells
2011-12-13 14:57 ` [PATCH 2/3] Adjust the comment on get_order() to describe the size==0 case David Howells
2011-12-19 18:45 ` H. Peter Anvin
2011-12-19 18:47 ` H. Peter Anvin
2011-12-20 15:09 ` Arnd Bergmann
2011-12-20 16:09 ` hpanvin@gmail.com
2011-12-20 15:39 ` David Howells
2012-02-20 21:22 ` H. Peter Anvin
-- strict thread matches above, loose matches on Subject: below --
2010-01-13 19:39 [PATCH 1/3] X86: Optimise fls(), ffs() and fls64() David Howells
2010-01-13 19:39 ` [PATCH 2/3] Adjust the comment on get_order() to describe the size==0 case David Howells
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100326144246.8583.24462.stgit@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).