1 Oct 2011 02:08
[RFCv3][PATCH 2/4] add string_get_size_pow2()
Dave Hansen <dave <at> linux.vnet.ibm.com>
2011-10-01 00:08:57 GMT
2011-10-01 00:08:57 GMT
This is a specialized version of string_get_size().
It only works on powers-of-two, and only outputs in
KiB/MiB/etc... Doing it this way means that we do
not have to do any division like string_get_size()
does.
Signed-off-by: Dave Hansen <dave <at> linux.vnet.ibm.com>
---
linux-2.6.git-dave/include/linux/string_helpers.h | 1
linux-2.6.git-dave/lib/string_helpers.c | 23 ++++++++++++++++++++++
2 files changed, 24 insertions(+)
diff -puN include/linux/string_helpers.h~string_get_size-pow2-1 include/linux/string_helpers.h
--- linux-2.6.git/include/linux/string_helpers.h~string_get_size-pow2-1 2011-09-30
17:03:00.511708995 -0700
+++ linux-2.6.git-dave/include/linux/string_helpers.h 2011-09-30 17:03:00.535708956 -0700
<at> <at> -10,6 +10,7 <at> <at> enum string_size_units {
STRING_UNITS_2, /* use binary powers of 2^10 */
};
+u64 string_get_size_pow2(u64 size, char *unit_ret);
int string_get_size(u64 size, enum string_size_units units,
char *buf, int len);
diff -puN lib/string_helpers.c~string_get_size-pow2-1 lib/string_helpers.c
--- linux-2.6.git/lib/string_helpers.c~string_get_size-pow2-1 2011-09-30 17:03:00.515708988 -0700
+++ linux-2.6.git-dave/lib/string_helpers.c 2011-09-30 17:03:00.535708956 -0700
(Continue reading)
> We have some code in our tree (not yet
> returned to the community) that tries to deal with some sources of interrupt
> jitter on tiles that are running isolcpu and want to be 100% in user space.
Yes, I think this work will benefit this kind of use case (CPU/user
space bound on a dedicated CPU)
the most, although other use cases can benefit as well (e.g. power
management with idle cores).
Btw, do you have any plan to share the patches you mentioned? it could
save me a lot of time. Not wanting to
re-invent the wheel and all that...
>> This first version creates an on_each_cpu_mask infrastructure API (derived
>> from
>> existing arch specific versions in Tile and Arm) and uses it to turn two
>> global
>> IPI invocation to per CPU group invocations.
>
> The global version looks fine; I would probably make on_each_cpu() an inline
> in the !SMP case now that you are (correctly, I suspect) disabling
> interrupts when calling the function.
RSS Feed