06 Jan, 2009
1 commit
-
... and don't bother in callers. Don't bother with zeroing i_blocks,
while we are at it - it's already been zeroed.i_mode is not worth the effort; it has no common default value.
Signed-off-by: Al Viro
01 Jan, 2009
1 commit
-
struct dentry is one of the most critical structures in the kernel. So it's
sad to see it going neglected.With CONFIG_PROFILING turned on (which is probably the common case at least
for distros and kernel developers), sizeof(struct dcache) == 208 here
(64-bit). This gives 19 objects per slab.I packed d_mounted into a hole, and took another 4 bytes off the inline
name length to take the padding out from the end of the structure. This
shinks it to 200 bytes. I could have gone the other way and increased the
length to 40, but I'm aiming for a magic number, read on...I then got rid of the d_cookie pointer. This shrinks it to 192 bytes. Rant:
why was this ever a good idea? The cookie system should increase its hash
size or use a tree or something if lookups are a problem. Also the "fast
dcookie lookups" in oprofile should be moved into the dcookie code -- how
can oprofile possibly care about the dcookie_mutex? It gets dropped after
get_dcookie() returns so it can't be providing any sort of protection.At 192 bytes, 21 objects fit into a 4K page, saving about 3MB on my system
with ~140 000 entries allocated. 192 is also a multiple of 64, so we get
nice cacheline alignment on 64 and 32 byte line systems -- any given dentry
will now require 3 cachelines to touch all fields wheras previously it
would require 4.I know the inline name size was chosen quite carefully, however with the
reduction in cacheline footprint, it should actually be just about as fast
to do a name lookup for a 36 character name as it was before the patch (and
faster for other sizes). The memory footprint savings for names which are
36 bytes long should more than make up for the memory cost for
33-36 byte names.Performance is a feature...
Signed-off-by: Al Viro
11 Dec, 2008
2 commits
-
The number of lost samples could be greater than the number of
received samples. This patches fixes this. The implementation
introduces return values for add_sample() and add_code().Signed-off-by: Robert Richter
-
This function is no longer available after the port to the new ring
buffer. Its removal can lead to incomplete sampling sequences since
IBS samples and backtraces are transfered in multiple samples. Due to
a full buffer, samples could be lost any time. The userspace daemon
has to live with such incomplete sampling sequences as long as the
data within one sample is consistent.This will be fixed by changing the internal buffer data there all data
of one IBS sample or a backtrace is packed in a single ring buffer
entry. This is possible since the new ring buffer supports variable
data size.Signed-off-by: Robert Richter
10 Dec, 2008
10 commits
-
This patch replaces the current oprofile cpu buffer implementation
with the ring buffer provided by the tracing framework. The motivation
here is to leave the pain of implementing ring buffers to others. Oh,
no, there are more advantages. Main reason is the support of different
sample sizes that could be stored in the buffer. Use cases for this
are IBS and Cell spu profiling. Using the new ring buffer ensures
valid and complete samples and allows copying the cpu buffer stateless
without knowing its content. Second it will use generic kernel API and
also reduce code size. And hopefully, there are less bugs.Since the new tracing ring buffer implementation uses spin locks to
protect the buffer during read/write access, it is difficult to use
the buffer in an NMI handler. In this case, writing to the buffer by
the NMI handler (x86) could occur also during critical sections when
reading the buffer. To avoid this, there are 2 buffers for independent
read and write access. Read access is in process context only, write
access only in the NMI handler. If the read buffer runs empty, both
buffers are swapped atomically. There is potentially a small window
during swapping where the buffers are disabled and samples could be
lost.Using 2 buffers is a little bit overhead, but the solution is clear
and does not require changes in the ring buffer implementation. It can
be changed to a single buffer solution when the ring buffer access is
implemented as non-locking atomic code.The new buffer requires more size to store the same amount of samples
because each sample includes an u32 header. Also, there is more code
to execute for buffer access. Nonetheless, the buffer implementation
is proven in the ftrace environment and worth to use also in oprofile.Patches that changes the internal IBS buffer usage will follow.
Cc: Steven Rostedt
Signed-off-by: Robert Richter -
This is in preparation for changes in the cpu buffer implementation.
Signed-off-by: Robert Richter
-
This is in preparation for changes in the cpu buffer implementation.
Signed-off-by: Robert Richter
-
This is in preparation for changes in the cpu buffer implementation.
Signed-off-by: Robert Richter
-
This is in preparation for changes in the cpu buffer implementation.
Signed-off-by: Robert Richter
-
This patch restores default values for:
/dev/oprofile/cpu_buffer_size
/dev/oprofile/buffer_watershed
/dev/oprofile/buffer_sizewhen creating the oprofilefs:
# opcontrol --deinit
# opcontrol --init
# cat /dev/oprofile/cpu_buffer_size
8192
# echo 5123 > /dev/oprofile/cpu_buffer_size
# cat /dev/oprofile/cpu_buffer_size
5123
# opcontrol --deinit
# opcontrol --init
# cat /dev/oprofile/cpu_buffer_size
8192
# opcontrol --deinitThis sets the values in a defined state. Before, there was no way to
restore the defaults without rebooting the system or reloading the
module.Signed-off-by: Robert Richter
-
Signed-off-by: Robert Richter
-
Signed-off-by: Robert Richter
-
Signed-off-by: Robert Richter
-
This fixes the coding style of some comments.
Signed-off-by: Robert Richter
28 Oct, 2008
1 commit
-
Regular bitops don't work as locks on all architectures.
Also: can use non-atomic unlock as no concurrent stores to the word.
Signed-off-by: Nick Piggin
Signed-off-by: Robert Richter
24 Oct, 2008
1 commit
-
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile: (21 commits)
OProfile: Fix buffer synchronization for IBS
oprofile: hotplug cpu fix
oprofile: fixing whitespaces in arch/x86/oprofile/*
oprofile: fixing whitespaces in arch/x86/oprofile/*
oprofile: fixing whitespaces in drivers/oprofile/*
x86/oprofile: add the logic for enabling additional IBS bits
x86/oprofile: reordering functions in nmi_int.c
x86/oprofile: removing unused function parameter in add_ibs_begin()
oprofile: more whitespace fixes
oprofile: whitespace fixes
OProfile: Rename IBS sysfs dir into "ibs_op"
OProfile: Rework string handling in setup_ibs_files()
OProfile: Rework oprofile_add_ibs_sample() function
oprofile: discover counters for op ppro too
oprofile: Implement Intel architectural perfmon support
oprofile: Don't report Nehalem as core_2
oprofile: drop const in num counters field
Revert "Oprofile Multiplexing Patch"
x86, oprofile: BUG: using smp_processor_id() in preemptible code
x86/oprofile: fix on_each_cpu build error
...Manually fixed trivial conflicts in
drivers/oprofile/{cpu_buffer.c,event_buffer.h}
21 Oct, 2008
1 commit
-
The issue is the SPU code is not holding the kernel mutex lock while
adding samples to the kernel buffer.This patch creates per SPU buffers to hold the data. Data
is added to the buffers from in interrupt context. The data
is periodically pushed to the kernel buffer via a new Oprofile
function oprofile_put_buff(). The oprofile_put_buff() function
is called via a work queue enabling the funtion to acquire the
mutex lock.The existing user controls for adjusting the per CPU buffer
size is used to control the size of the per SPU buffers.
Similarly, overflows of the SPU buffers are reported by
incrementing the per CPU buffer stats. This eliminates the
need to have architecture specific controls for the per SPU
buffers which is not acceptable to the OProfile user tool
maintainer.The export of the oprofile add_event_entry() is removed as it
is no longer needed given this patch.Note, this patch has not addressed the issue of indexing arrays
by the spu number. This still needs to be fixed as the spu
numbering is not guarenteed to be 0 to max_num_spus-1.Signed-off-by: Carl Love
Signed-off-by: Maynard Johnson
Signed-off-by: Arnd Bergmann
Acked-by: Acked-by: Robert Richter
Signed-off-by: Benjamin Herrenschmidt
20 Oct, 2008
1 commit
-
The patch is needed since there is some IBS code in add_ibs_begin()
that handles more than one sample per iteration. This requires calling
get_slots() during each loop.This fixes the current problem, but a proper solution that reworks the
cpu buffer synchronization is needed here in the future.Signed-off-by: Barry Kasindorf
Signed-off-by: Robert Richter
17 Oct, 2008
1 commit
-
This patch addresses problems when hotplugging cpus while
profiling. Instead of allocating only online cpus, all possible cpu
buffers are allocated, which allows cpus to be onlined during
operation. If a cpu is offlined before profiling is shutdown
wq_sync_buffer checks for this condition then cancels this work and
does not sync this buffer.Signed-off-by: Chris J Arges
Signed-off-by: Robert Richter
16 Oct, 2008
5 commits
-
Signed-off-by: Robert Richter
-
Signed-off-by: Robert Richter
-
Signed-off-by: Robert Richter
-
Signed-off-by: Robert Richter
-
Code looks much more cleaner now.
Signed-off-by: Robert Richter
13 Oct, 2008
1 commit
-
Conflicts:
arch/x86/kernel/apic_32.c
arch/x86/oprofile/nmi_int.c
include/linux/pci_ids.h
24 Sep, 2008
2 commits
-
Conflicts:
arch/x86/oprofile/nmi_int.c -
Reverting commit 1a960b402a51d80abf54e3f8e4972374ffe5f22d for the main
branch. Multiplexing will be tracked on a separate feature branch.Conflicts:
arch/x86/oprofile/nmi_int.c
26 Aug, 2008
1 commit
-
If an error occurs on opcontrol start, the event and per cpu buffers
are released. If later opcontrol shutdown is called then the free
function will be called again to free buffers that no longer
exist. This results in a kernel oops. The following changes
prevent the call to delete buffers that don't exist.Signed-off-by: Carl Love
Signed-off-by: Arnd Bergmann
Acked-by: Robert Richter
Signed-off-by: Paul Mackerras
26 Jul, 2008
6 commits
-
This patch introduces multiplexing support for the Oprofile kernel
module. It basically adds a new function pointer in oprofile_operator
allowing each architecture to supply its callback to switch between
different sets of event when the timer expires. Userspace tools can
modify the time slice through /dev/oprofile/time_slice.It also modifies the number of counters exposed to the userspace through
/dev/oprofile. For example, the number of counters for AMD CPUs are
changed to 32 and multiplexed in the sets of 4.Signed-off-by: Jason Yeh
Signed-off-by: Robert Richter
Cc: oprofile-list
Signed-off-by: Ingo Molnar -
Signed-off-by: Robert Richter
Cc: oprofile-list
Cc: Robert Richter
Cc: Barry Kasindorf
Signed-off-by: Ingo Molnar -
Signed-off-by: Robert Richter
Cc: oprofile-list
Cc: Robert Richter
Cc: Barry Kasindorf
Signed-off-by: Ingo Molnar -
This patchset supports the new profiling hardware available in the
latest AMD CPUs in the oProfile driver.Signed-off-by: Barry Kasindorf
Signed-off-by: Robert Richter
Cc: oprofile-list
Signed-off-by: Ingo Molnar -
Signed-off-by: Robert Richter
Cc: oprofile-list
Cc: Barry Kasindorf
Signed-off-by: Ingo Molnar -
Signed-off-by: Robert Richter
Cc: oprofile-list
Cc: Barry Kasindorf
Signed-off-by: Ingo Molnar
15 May, 2008
1 commit
-
Alignment was previously requested because cpu_buffer was an [NR_CPUS]
array, to avoid cache line sharing between CPUS.After commit 608dfddd845da5ab6accef70154c8910529699f7 (oprofile: change
cpu_buffer from array to per_cpu variable ), we dont need to force an
alignement anymore since cpu_buffer sits in per_cpu zone.Signed-off-by: Eric Dumazet
Cc: Mike Travis
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
28 Apr, 2008
1 commit
-
Change cpu_buffer from array to per_cpu variable in oprofile functions.
[akpm@linux-foundation.org: coding-style fixes]
Cc: Philippe Elie
Signed-off-by: Mike Travis
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
15 Feb, 2008
1 commit
-
get_dcookie() is always called with a dentry and a vfsmount from a struct
path. Make get_dcookie() take it directly as an argument.[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Jan Blunck
Acked-by: Christoph Hellwig
Cc: Al Viro
Cc: "J. Bruce Fields"
Cc: Neil Brown
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
15 Nov, 2007
1 commit
-
Instruction pointer returned by profile_pc() can be a random value. This
break the assumption than we can safely set struct op_sample.eip field to a
magic value to signal to the per-cpu buffer reader side special event like
task switch ending up in a segfault in get_task_mm() when profile_pc()
return ~0UL. Fixed by sanitizing the sampled eip and reject/log invalid
eip.Problem reported by Sami Farin, patch tested by him.
Signed-off-by: Philippe Elie
Tested-by: Sami Farin
Cc:
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
21 Jul, 2007
1 commit
-
From: Maynard Johnson
This patch updates the existing arch/powerpc/oprofile/op_model_cell.c
to add in the SPU profiling capabilities. In addition, a 'cell' subdirectory
was added to arch/powerpc/oprofile to hold Cell-specific SPU profiling code.
Exports spu_set_profile_private_kref and spu_get_profile_private_kref which
are used by OProfile to store private profile information in spufs data
structures.Also incorporated several fixes from other patches (rrn). Check pointer
returned from kzalloc. Eliminated unnecessary cast. Better error
handling and cleanup in the related area. 64-bit unsigned long parameter
was being demoted to 32-bit unsigned int and eventually promoted back to
unsigned long.Signed-off-by: Carl Love
Signed-off-by: Maynard Johnson
Signed-off-by: Bob Nelson
Signed-off-by: Arnd Bergmann
Acked-by: Paul Mackerras
22 May, 2007
1 commit
-
First thing mm.h does is including sched.h solely for can_do_mlock() inline
function which has "current" dereference inside. By dealing with can_do_mlock()
mm.h can be detached from sched.h which is good. See below, why.This patch
a) removes unconditional inclusion of sched.h from mm.h
b) makes can_do_mlock() normal function in mm/mlock.c
c) exports can_do_mlock() to not break compilation
d) adds sched.h inclusions back to files that were getting it indirectly.
e) adds less bloated headers to some files (asm/signal.h, jiffies.h) that were
getting them indirectlyNet result is:
a) mm.h users would get less code to open, read, preprocess, parse, ... if
they don't need sched.h
b) sched.h stops being dependency for significant number of files:
on x86_64 allmodconfig touching sched.h results in recompile of 4083 files,
after patch it's only 3744 (-8.3%).Cross-compile tested on
all arm defconfigs, all mips defconfigs, all powerpc defconfigs,
alpha alpha-up
arm
i386 i386-up i386-defconfig i386-allnoconfig
ia64 ia64-up
m68k
mips
parisc parisc-up
powerpc powerpc-up
s390 s390-up
sparc sparc-up
sparc64 sparc64-up
um-x86_64
x86_64 x86_64-up x86_64-defconfig x86_64-allnoconfigas well as my two usual configs.
Signed-off-by: Alexey Dobriyan
Signed-off-by: Linus Torvalds