Frederic Weisbecker
fef20d9c13
vsprintf: unify the format decoding layer for its 3 users
...
An new optimization is making its way to ftrace. Its purpose is to
make trace_printk() consuming less memory and be faster.
Written by Lai Jiangshan, the approach is to delay the formatting
job from tracing time to output time.
Currently, a call to trace_printk() will format the whole string and
insert it into the ring buffer. Then you can read it on /debug/tracing/trace
file.
The new implementation stores the address of the format string and
the binary parameters into the ring buffer, making the packet more compact
and faster to insert.
Later, when the user exports the traces, the format string is retrieved
with the binary parameters and the formatting job is eventually done.
The new implementation rewrites a lot of format decoding bits from
vsnprintf() function, making now 3 differents functions to maintain
in their duplicated parts of printf format decoding bits.
Suggested by Ingo Molnar, this patch tries to factorize the most
possible common bits from these functions.
The real common part between them is the format decoding. Although
they do somewhat similar jobs, their way to export or import the parameters
is very different. Thus, only the decoding layer is extracted, unless you see
other parts that could be worth factorized.
Changes in V2:
- Address a suggestion from Linus to group the format_decode() parameters inside
a structure.
Changes in v3:
- Address other cleanups suggested by Ingo and Linus such as passing the
printf_spec struct to the format helpers: pointer()/number()/string()
Note that this struct is passed by copy and not by address. This is to
avoid side effects because these functions often change these values and the
changes shoudn't be persistant when a callee helper returns.
It would be too risky.
- Various cleanups (code alignement, switch/case instead of if/else fountains).
- Fix a bug that printed the first format specifier following a %p
Changes in v4:
- drop unapropriate const qualifier loss while casting fmt to a char *
(thanks to Vegard Nossum for having pointed this out).
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <1236356510-8381-6-git-send-email-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-03-06 17:44:27 +01:00
..
lzo
lzo: use get/put_unaligned_* helpers
2008-07-25 10:53:26 -07:00
reed_solomon
lib: Remove unnecessary inclusions of asm/semaphore.h
2008-04-18 22:17:17 -04:00
zlib_deflate
lib/: Spelling fixes
2008-02-03 17:48:52 +02:00
zlib_inflate
[ZLIB]: Fix external builds of zlib_inflate code.
2007-10-11 22:17:20 -07:00
.gitignore
Add some basic .gitignore files
2005-10-18 08:26:15 -07:00
argv_split.c
LIB: Replace inappropriate include of <linux/bug.h>
2007-10-20 00:26:10 +02:00
audit.c
[PATCH] audit signal recipients
2007-05-11 05:38:25 -04:00
bcd.c
rtc: BCD codeshrink
2008-07-24 10:47:33 -07:00
bitmap.c
Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/dvrabel/uwb
2008-10-23 08:20:34 -07:00
bitrev.c
lib: export bitrev16
2008-06-06 11:29:10 -07:00
bug.c
allow bug table entries to use relative pointers (and use it on x86-64)
2008-12-16 18:40:32 +01:00
bust_spinlocks.c
oops handling: ensure that any oops is flushed to the mtdoops console
2009-01-06 15:59:11 -08:00
check_signature.c
uninline check_signature()
2007-07-16 09:05:50 -07:00
cmdline.c
generic, memparse(): constify argument
2008-07-28 15:05:23 +02:00
cpumask.c
cpumask: zero extra bits in alloc_cpumask_var_node
2009-01-01 10:12:30 +10:30
crc-ccitt.c
[PATCH] kernel-doc for lib/crc*.c
2006-06-25 10:01:20 -07:00
crc-itu-t.c
CRC ITU-T V.41
2007-05-10 18:24:13 +02:00
crc-t10dif.c
[SCSI] lib: Add support for the T10 (SCSI) Data Integrity Field CRC
2008-07-12 08:22:32 -05:00
crc7.c
CRC7 support
2007-07-17 10:23:04 -07:00
crc16.c
[PATCH] kernel-doc for lib/crc*.c
2006-06-25 10:01:20 -07:00
crc32.c
lib/: Spelling fixes
2008-02-03 17:48:52 +02:00
crc32defs.h
Linux-2.6.12-rc2
2005-04-16 15:20:36 -07:00
ctype.c
Linux-2.6.12-rc2
2005-04-16 15:20:36 -07:00
debug_locks.c
debug_locks: set oops_in_progress if we will log messages.
2008-08-01 10:46:43 +02:00
debugobjects.c
debugobjects: add boot parameter default value
2008-11-26 10:07:06 +01:00
dec_and_lock.c
[PATCH] atomic: dec_and_lock use atomic primitives
2006-01-08 20:13:48 -08:00
devres.c
[POWERPC] devres: Add devm_ioremap_prot()
2008-05-05 16:47:14 +10:00
div64.c
add an inlined version of iter_div_u64_rem
2008-06-12 10:47:58 +02:00
dump_stack.c
Linux-2.6.12-rc2
2005-04-16 15:20:36 -07:00
dynamic_printk.c
dynamic_printk: reduce one level of indentation
2009-01-06 10:44:32 -08:00
extable.c
lib/extable.c: remove an expensive integer divide in search_extable()
2008-02-06 10:41:08 -08:00
fault-inject.c
Remove remaining unwinder code
2009-01-06 15:59:11 -08:00
find_last_bit.c
bitmap: find_last_bit()
2009-01-01 10:12:19 +10:30
find_next_bit.c
bitops: remove "optimizations"
2008-04-29 08:11:16 -07:00
gen_crc32table.c
Linux-2.6.12-rc2
2005-04-16 15:20:36 -07:00
genalloc.c
Slab allocators: Replace explicit zeroing with __GFP_ZERO
2007-07-17 10:23:02 -07:00
halfmd4.c
Linux-2.6.12-rc2
2005-04-16 15:20:36 -07:00
hexdump.c
lib: create common ascii hex array
2008-05-14 19:11:14 -07:00
hweight.c
remove asm/bitops.h includes
2007-10-19 11:53:41 -07:00
idr.c
lib/idr.c: use kmem_cache_zalloc() for the idr_layer cache
2009-01-15 16:39:40 -08:00
inflate.c
inflate: refactor inflate malloc code
2008-07-25 10:53:28 -07:00
int_sqrt.c
[PATCH] lib: Fix bug in int_sqrt() for 64 bit longs
2006-02-03 08:32:08 -08:00
iomap.c
Use WARN() in lib/
2008-07-26 12:00:07 -07:00
iomap_copy.c
[PATCH] add __iowrite64_copy
2006-06-20 20:24:58 -07:00
iommu-helper.c
introduce generic iommu_num_pages function
2008-10-16 11:21:33 -07:00
ioremap.c
lib/ioremap.c should #include <linux/io.h>
2007-10-17 08:42:50 -07:00
irq_regs.c
[PATCH] irq_reqs: export __irq_regs
2006-10-06 08:53:40 -07:00
is_single_threaded.c
CRED: Rename is_single_threaded() to is_wq_single_threaded()
2008-11-14 10:39:21 +11:00
kasprintf.c
lib: move kasprintf to a separate file
2007-07-31 15:39:39 -07:00
Kconfig
vsprintf: add binary printf
2009-03-06 17:39:04 +01:00
Kconfig.debug
Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
2009-01-26 09:47:56 -08:00
Kconfig.kgdb
kgdb: remove the requirement for CONFIG_FRAME_POINTER
2008-08-01 08:39:34 -05:00
kernel_lock.c
BKL: revert back to the old spinlock implementation
2008-05-10 20:58:02 -07:00
klist.c
driver core: Remove completion from struct klist_node
2009-01-06 10:44:30 -08:00
kobject.c
kobject: Cleanup kobject_rename and !CONFIG_SYSFS
2008-10-16 09:24:52 -07:00
kobject_uevent.c
kobject: return the result of uevent sending by netlink
2009-01-06 10:44:31 -08:00
kref.c
kref: add kref_set()
2008-01-24 20:40:05 -08:00
libcrc32c.c
libcrc32c: Fix "crc32c undefined" compilation error
2008-12-25 11:01:42 +11:00
list_debug.c
list debugging: use WARN() instead of BUG()
2008-07-25 10:53:29 -07:00
lmb.c
lmb: Fix reserved region handling in lmb_enforce_memory_limit().
2008-08-15 19:57:57 -07:00
locking-selftest-hardirq.h
[PATCH] lockdep: locking API self tests
2006-07-03 15:27:03 -07:00
locking-selftest-mutex.h
[PATCH] lockdep: locking API self tests
2006-07-03 15:27:03 -07:00
locking-selftest-rlock-hardirq.h
[PATCH] lockdep: locking API self tests
2006-07-03 15:27:03 -07:00
locking-selftest-rlock-softirq.h
[PATCH] lockdep: locking API self tests
2006-07-03 15:27:03 -07:00
locking-selftest-rlock.h
[PATCH] lockdep: locking API self tests
2006-07-03 15:27:03 -07:00
locking-selftest-rsem.h
[PATCH] lockdep: locking API self tests
2006-07-03 15:27:03 -07:00
locking-selftest-softirq.h
[PATCH] lockdep: locking API self tests
2006-07-03 15:27:03 -07:00
locking-selftest-spin-hardirq.h
[PATCH] lockdep: locking API self tests
2006-07-03 15:27:03 -07:00
locking-selftest-spin-softirq.h
[PATCH] lockdep: locking API self tests
2006-07-03 15:27:03 -07:00
locking-selftest-spin.h
[PATCH] lockdep: locking API self tests
2006-07-03 15:27:03 -07:00
locking-selftest-wlock-hardirq.h
[PATCH] lockdep: locking API self tests
2006-07-03 15:27:03 -07:00
locking-selftest-wlock-softirq.h
[PATCH] lockdep: locking API self tests
2006-07-03 15:27:03 -07:00
locking-selftest-wlock.h
[PATCH] lockdep: locking API self tests
2006-07-03 15:27:03 -07:00
locking-selftest-wsem.h
[PATCH] lockdep: locking API self tests
2006-07-03 15:27:03 -07:00
locking-selftest.c
[PATCH] lockdep: show more details about self-test failures
2006-12-07 08:39:43 -08:00
Makefile
bitmap: find_last_bit()
2009-01-01 10:12:19 +10:30
parser.c
vfs: Use const for kernel parser table
2008-10-13 10:10:37 -07:00
percpu_counter.c
Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
2009-01-06 17:10:04 -08:00
plist.c
Use WARN() in lib/
2008-07-26 12:00:07 -07:00
prio_heap.c
lib: fix sparse shadowed variable warning
2009-01-06 15:59:11 -08:00
prio_tree.c
Linux-2.6.12-rc2
2005-04-16 15:20:36 -07:00
proportions.c
Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
2009-01-06 17:10:04 -08:00
radix-tree.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
2009-01-07 11:31:52 -08:00
random32.c
random32: seeding improvement
2008-07-30 16:29:19 -07:00
ratelimit.c
__ratelimit() cpu flags can't be static
2008-07-28 16:30:20 -07:00
rbtree.c
rbtree: add const qualifier to some functions
2009-01-10 06:04:33 -08:00
reciprocal_div.c
[PATCH] SLAB: use a multiply instead of a divide in obj_to_index()
2006-12-13 09:05:49 -08:00
rwsem-spinlock.c
lib: remove fastcall from lib/*
2008-02-08 09:22:31 -08:00
rwsem.c
x86: fix UML and -regparm=3
2008-01-30 13:33:00 +01:00
scatterlist.c
lib/scatterlist.c: fix kunmap() argument in sg_miter_stop()
2008-11-19 18:49:58 -08:00
sha1.c
[PATCH] Numerous fixes to kernel-doc info in source files.
2007-02-11 10:51:32 -08:00
show_mem.c
lib: generic show_mem()
2008-07-26 12:00:10 -07:00
smp_processor_id.c
cpumask: convert lib/smp_processor_id to new cpumask ops
2009-01-30 15:47:34 +01:00
sort.c
generic swap(): lib/sort.c: rename swap to swap_func
2009-01-08 08:31:14 -08:00
spinlock_debug.c
Use helpers to obtain task pid in printks
2007-10-19 11:53:43 -07:00
string.c
Add a new sysfs_streq() string comparison function
2008-05-01 08:03:59 -07:00
string_helpers.c
[SCSI] lib: string_get_size(): don't hang on zero; no decimals on exact
2008-10-23 11:42:20 -05:00
swiotlb.c
Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
2009-01-06 17:10:04 -08:00
syscall.c
task_current_syscall
2008-07-26 12:00:10 -07:00
textsearch.c
remove CONFIG_KMOD from lib
2008-07-22 19:24:31 +10:00
ts_bm.c
textsearch: ts_bm: support case insensitive searching in Boyer-Moore algorithm
2008-07-08 02:37:54 -07:00
ts_fsm.c
textsearch: ts_fsm: return error on request for case insensitive search
2008-07-08 02:38:27 -07:00
ts_kmp.c
textsearch: ts_kmp: support case insensitive searching in Knuth-Morris-Pratt algorithm
2008-07-08 02:38:09 -07:00
vsprintf.c
vsprintf: unify the format decoding layer for its 3 users
2009-03-06 17:44:27 +01:00