1 diff -Nurb --exclude='*.cmd' --exclude='*.orig' --exclude='*.swp' --exclude=tags --exclude='*.patch' --exclude='*.diff' --exclude='*.svn*' linux-2.6.22-590/arch/i386/Kconfig linux-2.6.22-591/arch/i386/Kconfig
2 --- linux-2.6.22-590/arch/i386/Kconfig 2009-03-16 20:49:42.000000000 -0400
3 +++ linux-2.6.22-591/arch/i386/Kconfig 2009-03-16 20:58:59.000000000 -0400
6 source "arch/i386/oprofile/Kconfig"
9 + bool "Chopstix (PlanetLab)"
10 + depends on MODULES && OPROFILE
12 + Chopstix allows you to monitor various events by summarizing them
13 + in lossy data structures and transferring these data structures
14 + into user space. If in doubt, say "N".
17 bool "Kprobes (EXPERIMENTAL)"
18 depends on KALLSYMS && EXPERIMENTAL && MODULES
19 --- linux-2.6.22-590/arch/i386/kernel/asm-offsets.c 2007-07-08 19:32:17.000000000 -0400
20 +++ linux-2.6.22-591/arch/i386/kernel/asm-offsets.c 2009-03-16 20:58:59.000000000 -0400
22 #include <linux/signal.h>
23 #include <linux/personality.h>
24 #include <linux/suspend.h>
25 +#include <linux/arrays.h>
26 #include <asm/ucontext.h>
28 #include <asm/pgtable.h>
30 #define OFFSET(sym, str, mem) \
31 DEFINE(sym, offsetof(struct str, mem));
33 +#define STACKOFFSET(sym, str, mem) \
34 + DEFINE(sym, offsetof(struct str, mem)-sizeof(struct str));
36 /* workaround for a warning with -Wmissing-prototypes */
41 + unsigned long dcookie;
43 + unsigned int number;
48 OFFSET(SIGCONTEXT_eax, sigcontext, eax);
50 OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id);
53 - OFFSET(TI_task, thread_info, task);
54 + STACKOFFSET(TASK_thread, task_struct, thread);
55 + STACKOFFSET(THREAD_esp, thread_struct, esp);
56 + STACKOFFSET(EVENT_event_data, event, event_data);
57 + STACKOFFSET(EVENT_task, event, task);
58 + STACKOFFSET(EVENT_event_type, event, event_type);
59 + STACKOFFSET(SPEC_number, event_spec, number);
60 + DEFINE(EVENT_SIZE, sizeof(struct event));
61 + DEFINE(SPEC_SIZE, sizeof(struct event_spec));
62 + DEFINE(SPEC_EVENT_SIZE, sizeof(struct event_spec)+sizeof(struct event));
64 OFFSET(TI_exec_domain, thread_info, exec_domain);
65 OFFSET(TI_flags, thread_info, flags);
66 OFFSET(TI_status, thread_info, status);
67 --- linux-2.6.22-590/arch/i386/kernel/entry.S 2009-03-16 20:49:07.000000000 -0400
68 +++ linux-2.6.22-591/arch/i386/kernel/entry.S 2009-03-16 20:58:59.000000000 -0400
70 cmpl $(nr_syscalls), %eax
73 + /* Move Chopstix syscall probe here */
74 + /* Save and clobber: eax, ecx, ebp */
79 + subl $SPEC_EVENT_SIZE, %esp
80 + movl rec_event, %ecx
83 + # struct event is first, just below %ebp
84 + movl %eax, (SPEC_number-EVENT_SIZE)(%ebp)
85 + leal -SPEC_EVENT_SIZE(%ebp), %eax
86 + movl %eax, EVENT_event_data(%ebp)
87 + movl $6, EVENT_event_type(%ebp)
88 + movl rec_event, %edx
90 + leal -EVENT_SIZE(%ebp), %eax
94 + addl $SPEC_EVENT_SIZE, %esp
100 call *sys_call_table(,%eax,4)
101 movl %eax,PT_EAX(%esp) # store the return value
103 --- linux-2.6.22-590/arch/i386/mm/fault.c 2009-03-16 20:49:42.000000000 -0400
104 +++ linux-2.6.22-591/arch/i386/mm/fault.c 2009-03-16 20:58:59.000000000 -0400
106 DIE_PAGE_FAULT, &args);
110 +extern void (*rec_event)(void *,unsigned int);
113 + unsigned long dcookie;
115 + unsigned char reason;
119 * Return EIP plus the CS segment base. The segment limit is also
120 * adjusted, clamped to the kernel/user address space (whichever is
122 * bit 3 == 1 means use of reserved bit detected
123 * bit 4 == 1 means fault was an instruction fetch
127 fastcall void __kprobes do_page_fault(struct pt_regs *regs,
128 unsigned long error_code)
130 --- linux-2.6.22-590/block/ll_rw_blk.c 2009-03-16 20:49:07.000000000 -0400
131 +++ linux-2.6.22-591/block/ll_rw_blk.c 2009-03-16 20:58:59.000000000 -0400
133 #include <linux/cpu.h>
134 #include <linux/blktrace_api.h>
135 #include <linux/fault-inject.h>
136 +#include <linux/arrays.h>
140 @@ -3102,6 +3103,13 @@
142 #endif /* CONFIG_FAIL_MAKE_REQUEST */
144 +extern void (*rec_event)(void *,unsigned int);
147 + unsigned long dcookie;
149 + unsigned char reason;
152 * generic_make_request: hand a buffer to its device driver for I/O
153 * @bio: The bio describing the location in memory and on the device.
154 @@ -3220,7 +3228,23 @@
159 +#ifdef CONFIG_CHOPSTIX
161 + struct event event;
162 + struct event_spec espec;
165 + espec.reason = 0;/*request */
167 + eip = bio->bi_end_io;
168 + event.event_data=&espec;
170 + event.event_type=3;
171 + /* index in the event array currently set up */
172 + /* make sure the counters are loaded in the order we want them to show up*/
173 + (*rec_event)(&event, bio->bi_size);
176 ret = q->make_request_fn(q, bio);
179 --- linux-2.6.22-590/drivers/oprofile/cpu_buffer.c 2007-07-08 19:32:17.000000000 -0400
180 +++ linux-2.6.22-591/drivers/oprofile/cpu_buffer.c 2009-03-16 20:58:59.000000000 -0400
182 #include <linux/oprofile.h>
183 #include <linux/vmalloc.h>
184 #include <linux/errno.h>
185 +#include <linux/arrays.h>
187 #include "event_buffer.h"
188 #include "cpu_buffer.h"
193 +#ifdef CONFIG_CHOPSTIX
197 + unsigned long dcookie;
201 +extern void (*rec_event)(void *,unsigned int);
205 add_sample(struct oprofile_cpu_buffer * cpu_buf,
206 unsigned long pc, unsigned long event)
209 entry->event = event;
210 increment_head(cpu_buf);
217 int is_kernel = !user_mode(regs);
218 unsigned long pc = profile_pc(regs);
221 +#ifdef CONFIG_CHOPSTIX
224 + struct event_spec espec;
225 + esig.task = current;
228 + esig.event_data=&espec;
229 + esig.event_type=event; /* index in the event array currently set up */
230 + /* make sure the counters are loaded in the order we want them to show up*/
231 + (*rec_event)(&esig, 1);
234 oprofile_add_ext_sample(pc, regs, event, is_kernel);
237 + oprofile_add_ext_sample(pc, regs, event, is_kernel);
243 void oprofile_add_pc(unsigned long pc, int is_kernel, unsigned long event)
244 --- linux-2.6.22-590/fs/bio.c 2007-07-08 19:32:17.000000000 -0400
245 +++ linux-2.6.22-591/fs/bio.c 2009-03-16 20:58:59.000000000 -0400
247 #include <linux/workqueue.h>
248 #include <linux/blktrace_api.h>
249 #include <scsi/sg.h> /* for struct sg_iovec */
250 +#include <linux/arrays.h>
252 #define BIO_POOL_SIZE 2
255 struct kmem_cache *slab;
260 * if you change this list, also change bvec_alloc or things will
261 * break badly! cannot be bigger than what you can fit into an
262 @@ -999,6 +1001,14 @@
268 + unsigned long dcookie;
270 + unsigned char reason;
273 +extern void (*rec_event)(void *,unsigned int);
275 * bio_endio - end I/O on a bio
277 @@ -1028,6 +1038,24 @@
278 bio->bi_size -= bytes_done;
279 bio->bi_sector += (bytes_done >> 9);
281 +#ifdef CONFIG_CHOPSTIX
283 + struct event event;
284 + struct event_spec espec;
287 + espec.reason = 1;/*response */
289 + eip = bio->bi_end_io;
290 + event.event_data=&espec;
292 + event.event_type=3;
293 + /* index in the event array currently set up */
294 + /* make sure the counters are loaded in the order we want them to show up*/
295 + (*rec_event)(&event, bytes_done);
300 bio->bi_end_io(bio, bytes_done, error);
302 --- linux-2.6.22-590/fs/exec.c 2009-03-16 20:49:42.000000000 -0400
303 +++ linux-2.6.22-591/fs/exec.c 2009-03-16 20:58:59.000000000 -0400
305 #include <linux/mman.h>
306 #include <linux/a.out.h>
307 #include <linux/stat.h>
308 +#include <linux/dcookies.h>
309 #include <linux/fcntl.h>
310 #include <linux/smp_lock.h>
311 #include <linux/init.h>
313 #include <linux/binfmts.h>
314 #include <linux/swap.h>
315 #include <linux/utsname.h>
316 -#include <linux/pid_namespace.h>
317 +/*#include <linux/pid_namespace.h>*/
318 #include <linux/module.h>
319 #include <linux/namei.h>
320 #include <linux/proc_fs.h>
324 struct inode *inode = nd.dentry->d_inode;
325 +#ifdef CONFIG_CHOPSTIX
326 + unsigned long cookie;
327 + if (!nd.dentry->d_cookie)
328 + get_dcookie(nd.dentry, nd.mnt, &cookie);
331 file = ERR_PTR(-EACCES);
332 if (!(nd.mnt->mnt_flags & MNT_NOEXEC) &&
333 S_ISREG(inode->i_mode)) {
335 * Reparenting needs write_lock on tasklist_lock,
336 * so it is safe to do it under read_lock.
339 if (unlikely(tsk->group_leader == child_reaper(tsk)))
340 tsk->nsproxy->pid_ns->child_reaper = tsk;
343 zap_other_threads(tsk);
344 read_unlock(&tasklist_lock);
345 --- linux-2.6.22-590/include/linux/arrays.h 1969-12-31 19:00:00.000000000 -0500
346 +++ linux-2.6.22-591/include/linux/arrays.h 2009-03-16 20:58:59.000000000 -0400
348 +#ifndef __ARRAYS_H__
349 +#define __ARRAYS_H__
350 +#include <linux/list.h>
352 +#define SAMPLING_METHOD_DEFAULT 0
353 +#define SAMPLING_METHOD_LOG 1
355 +/* Every probe has an array handler */
357 +/* XXX - Optimize this structure */
359 +extern void (*rec_event)(void *,unsigned int);
360 +struct array_handler {
361 + struct list_head link;
362 + unsigned int (*hash_func)(void *);
363 + unsigned int (*sampling_func)(void *,int,void *);
364 + unsigned short size;
365 + unsigned int threshold;
366 + unsigned char **expcount;
367 + unsigned int sampling_method;
368 + unsigned int **arrays;
369 + unsigned int arraysize;
370 + unsigned int num_samples[2];
371 + void **epoch_samples; /* size-sized lists of samples */
372 + unsigned int (*serialize)(void *, void *);
373 + unsigned char code[5];
377 + struct list_head link;
379 + unsigned int count;
380 + unsigned int event_type;
381 + struct task_struct *task;
384 --- linux-2.6.22-590/include/linux/mutex.h 2007-07-08 19:32:17.000000000 -0400
385 +++ linux-2.6.22-591/include/linux/mutex.h 2009-03-16 20:58:59.000000000 -0400
387 struct thread_info *owner;
391 +#ifdef CONFIG_CHOPSTIX
392 + struct thread_info *owner;
395 #ifdef CONFIG_DEBUG_LOCK_ALLOC
396 struct lockdep_map dep_map;
397 --- linux-2.6.22-590/include/linux/sched.h 2009-03-16 20:49:42.000000000 -0400
398 +++ linux-2.6.22-591/include/linux/sched.h 2009-03-16 20:58:59.000000000 -0400
401 unsigned long sleep_avg;
402 unsigned long long timestamp, last_ran;
403 +#ifdef CONFIG_CHOPSTIX
404 + unsigned long last_interrupted, last_ran_j;
407 unsigned long long sched_time; /* sched_clock time spent running */
408 enum sleep_type sleep_type;
410 --- linux-2.6.22-590/kernel/mutex.c 2007-07-08 19:32:17.000000000 -0400
411 +++ linux-2.6.22-591/kernel/mutex.c 2009-03-16 20:58:59.000000000 -0400
413 #include <linux/spinlock.h>
414 #include <linux/interrupt.h>
415 #include <linux/debug_locks.h>
416 +#include <linux/arrays.h>
418 +#undef CONFIG_CHOPSTIX
419 +#ifdef CONFIG_CHOPSTIX
422 + unsigned long dcookie;
424 + unsigned char reason;
429 * In the DEBUG case we are using the "NULL fastpath" for mutexes,
431 __mutex_init(struct mutex *lock, const char *name, struct lock_class_key *key)
433 atomic_set(&lock->count, 1);
434 +#ifdef CONFIG_CHOPSTIX
437 spin_lock_init(&lock->wait_lock);
438 INIT_LIST_HEAD(&lock->wait_list);
441 * The locking fastpath is the 1->0 transition from
442 * 'unlocked' into 'locked' state.
445 __mutex_fastpath_lock(&lock->count, __mutex_lock_slowpath);
450 __set_task_state(task, state);
452 +#ifdef CONFIG_CHOPSTIX
455 + struct event event;
456 + struct event_spec espec;
457 + struct task_struct *p = lock->owner->task;
458 + /*spin_lock(&p->alloc_lock);*/
459 + espec.reason = 0; /* lock */
460 + event.event_data=&espec;
463 + event.event_type=5;
464 + (*rec_event)(&event, 1);
465 + /*spin_unlock(&p->alloc_lock);*/
473 /* didnt get the lock, go to sleep: */
474 spin_unlock_mutex(&lock->wait_lock, flags);
477 /* got the lock - rejoice! */
478 mutex_remove_waiter(lock, &waiter, task_thread_info(task));
479 debug_mutex_set_owner(lock, task_thread_info(task));
480 +#ifdef CONFIG_CHOPSTIX
481 + lock->owner = task_thread_info(task);
484 /* set it to 0 if there are no waiters left: */
485 if (likely(list_empty(&lock->wait_list)))
487 mutex_lock_nested(struct mutex *lock, unsigned int subclass)
491 __mutex_lock_common(lock, TASK_UNINTERRUPTIBLE, subclass);
495 mutex_lock_interruptible_nested(struct mutex *lock, unsigned int subclass)
499 return __mutex_lock_common(lock, TASK_INTERRUPTIBLE, subclass);
504 debug_mutex_wake_waiter(lock, waiter);
506 +#ifdef CONFIG_CHOPSTIX
509 + struct event event;
510 + struct event_spec espec;
512 + espec.reason = 1; /* unlock */
513 + event.event_data=&espec;
514 + event.task = lock->owner->task;
516 + event.event_type=5;
517 + (*rec_event)(&event, 1);
523 wake_up_process(waiter->task);
526 --- linux-2.6.22-590/kernel/sched.c 2009-03-16 20:49:42.000000000 -0400
527 +++ linux-2.6.22-591/kernel/sched.c 2009-03-16 20:58:59.000000000 -0400
529 * 1998-11-19 Implemented schedule_timeout() and related stuff
530 * by Andrea Arcangeli
531 * 2002-01-04 New ultra-scalable O(1) scheduler by Ingo Molnar:
532 - * hybrid priority-list and round-robin design with
533 + * hybrid priority-list and round-robin deventn with
534 * an array-switch method of distributing timeslices
535 * and per-CPU runqueues. Cleanups and useful suggestions
536 * by Davide Libenzi, preemptible kernel bits by Robert Love.
538 #include <linux/nmi.h>
539 #include <linux/init.h>
540 #include <asm/uaccess.h>
541 +#include <linux/arrays.h>
542 #include <linux/highmem.h>
543 #include <linux/smp_lock.h>
544 #include <asm/mmu_context.h>
546 #include <linux/vs_sched.h>
547 #include <linux/vs_cvirt.h>
549 +#define INTERRUPTIBLE -1
553 * Scheduler clock - returns current time in nanosec units.
554 * This is default implementation.
560 spin_lock(&rq->lock);
561 if (unlikely(rq != task_rq(p))) {
562 spin_unlock(&rq->lock);
563 @@ -1741,6 +1746,21 @@
564 * event cannot wake it up and insert it on the runqueue either.
566 p->state = TASK_RUNNING;
567 +#ifdef CONFIG_CHOPSTIX
568 + /* The jiffy of last interruption */
569 + if (p->state & TASK_UNINTERRUPTIBLE) {
570 + p->last_interrupted=jiffies;
573 + if (p->state & TASK_INTERRUPTIBLE) {
574 + p->last_interrupted=INTERRUPTIBLE;
577 + p->last_interrupted=RUNNING;
579 + /* The jiffy of last execution */
580 + p->last_ran_j=jiffies;
584 * Make sure we do not leak PI boosting priority to the child:
585 @@ -3608,6 +3628,7 @@
590 static inline int interactive_sleep(enum sleep_type sleep_type)
592 return (sleep_type == SLEEP_INTERACTIVE ||
593 @@ -3617,16 +3638,28 @@
595 * schedule() is the main scheduler function.
598 +#ifdef CONFIG_CHOPSTIX
599 +extern void (*rec_event)(void *,unsigned int);
602 + unsigned long dcookie;
603 + unsigned int count;
604 + unsigned int reason;
608 asmlinkage void __sched schedule(void)
610 struct task_struct *prev, *next;
611 struct prio_array *array;
612 struct list_head *queue;
613 unsigned long long now;
614 - unsigned long run_time;
615 + unsigned long run_time, diff;
616 int cpu, idx, new_prio;
619 + int sampling_reason;
622 * Test if we are atomic. Since do_exit() needs to call into
623 @@ -3680,6 +3713,7 @@
624 switch_count = &prev->nivcsw;
625 if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) {
626 switch_count = &prev->nvcsw;
628 if (unlikely((prev->state & TASK_INTERRUPTIBLE) &&
629 unlikely(signal_pending(prev))))
630 prev->state = TASK_RUNNING;
631 @@ -3689,6 +3723,17 @@
632 vx_uninterruptible_inc(prev);
634 deactivate_task(prev, rq);
635 +#ifdef CONFIG_CHOPSTIX
636 + /* An uninterruptible process just yielded. Record the current jiffie */
637 + if (prev->state & TASK_UNINTERRUPTIBLE) {
638 + prev->last_interrupted=jiffies;
640 + /* An interruptible process just yielded, or it got preempted.
641 + * Mark it as interruptible */
642 + else if (prev->state & TASK_INTERRUPTIBLE) {
643 + prev->last_interrupted=INTERRUPTIBLE;
649 @@ -3765,6 +3810,40 @@
651 prev->timestamp = prev->last_ran = now;
653 +#ifdef CONFIG_CHOPSTIX
654 + /* Run only if the Chopstix module so decrees it */
656 + prev->last_ran_j = jiffies;
657 + if (next->last_interrupted!=INTERRUPTIBLE) {
658 + if (next->last_interrupted!=RUNNING) {
659 + diff = (jiffies-next->last_interrupted);
660 + sampling_reason = 0;/* BLOCKING */
663 + diff = jiffies-next->last_ran_j;
664 + sampling_reason = 1;/* PREEMPTION */
667 + if (diff >= HZ/10) {
668 + struct event event;
669 + struct event_spec espec;
670 + struct pt_regs *regs;
671 + regs = task_pt_regs(current);
673 + espec.reason = sampling_reason;
674 + event.event_data=&espec;
676 + espec.pc=regs->eip;
677 + event.event_type=2;
678 + /* index in the event array currently set up */
679 + /* make sure the counters are loaded in the order we want them to show up*/
680 + (*rec_event)(&event, diff);
683 + /* next has been elected to run */
684 + next->last_interrupted=0;
687 sched_info_switch(prev, next);
688 if (likely(prev != next)) {
689 next->timestamp = next->last_ran = now;
690 @@ -4664,6 +4743,7 @@
692 read_unlock(&tasklist_lock);
696 if ((current->euid != p->euid) && (current->euid != p->uid) &&
697 !capable(CAP_SYS_NICE))
698 @@ -5032,6 +5112,7 @@
699 jiffies_to_timespec(p->policy == SCHED_FIFO ?
700 0 : task_timeslice(p), &t);
701 read_unlock(&tasklist_lock);
703 retval = copy_to_user(interval, &t, sizeof(t)) ? -EFAULT : 0;
706 @@ -7275,3 +7356,20 @@
711 +#ifdef CONFIG_CHOPSTIX
712 +void (*rec_event)(void *,unsigned int) = NULL;
714 +/* To support safe calling from asm */
715 +asmlinkage void rec_event_asm (struct event *event_signature_in, unsigned int count) {
716 + struct pt_regs *regs;
717 + struct event_spec *es = event_signature_in->event_data;
718 + regs = task_pt_regs(current);
719 + event_signature_in->task=current;
721 + event_signature_in->count=1;
722 + (*rec_event)(event_signature_in, count);
724 +EXPORT_SYMBOL(rec_event);
725 +EXPORT_SYMBOL(in_sched_functions);
727 --- linux-2.6.22-590/mm/memory.c 2009-03-16 20:49:42.000000000 -0400
728 +++ linux-2.6.22-591/mm/memory.c 2009-03-16 20:58:59.000000000 -0400
731 #include <linux/swapops.h>
732 #include <linux/elf.h>
733 +#include <linux/arrays.h>
735 #ifndef CONFIG_NEED_MULTIPLE_NODES
736 /* use the per-pgdat data instead for discontigmem - mbligh */
737 @@ -2601,6 +2602,15 @@
741 +extern void (*rec_event)(void *,unsigned int);
744 + unsigned long dcookie;
746 + unsigned char reason;
751 * By the time we get here, we already hold the mm semaphore
753 @@ -2630,6 +2640,24 @@
757 +#ifdef CONFIG_CHOPSTIX
759 + struct event event;
760 + struct event_spec espec;
761 + struct pt_regs *regs;
763 + regs = task_pt_regs(current);
764 + pc = regs->eip & (unsigned int) ~4095;
766 + espec.reason = 0; /* alloc */
767 + event.event_data=&espec;
768 + event.task = current;
770 + event.event_type=5;
771 + (*rec_event)(&event, 1);
775 return handle_pte_fault(mm, vma, address, pte, pmd, write_access);
778 --- linux-2.6.22-590/mm/slab.c 2009-03-16 20:49:42.000000000 -0400
779 +++ linux-2.6.22-591/mm/slab.c 2009-03-16 21:00:27.000000000 -0400
780 @@ -110,11 +110,13 @@
781 #include <linux/fault-inject.h>
782 #include <linux/rtmutex.h>
783 #include <linux/reciprocal_div.h>
784 +#include <linux/arrays.h>
786 #include <asm/cacheflush.h>
787 #include <asm/tlbflush.h>
788 #include <asm/page.h>
792 * DEBUG - 1 for kmem_cache_create() to honour; SLAB_RED_ZONE & SLAB_POISON.
793 * 0 for faster, smaller code (especially in the critical paths).
798 +extern void (*rec_event)(void *,unsigned int);
801 + unsigned long dcookie;
803 + unsigned char reason;
809 @@ -3443,6 +3453,19 @@
810 local_irq_restore(save_flags);
811 objp = cache_alloc_debugcheck_after(cachep, flags, objp, caller);
813 +#ifdef CONFIG_CHOPSTIX
814 + if (rec_event && objp) {
815 + struct event event;
816 + struct event_spec espec;
818 + espec.reason = 0; /* alloc */
819 + event.event_data=&espec;
820 + event.task = current;
822 + event.event_type=5;
823 + (*rec_event)(&event, cachep->buffer_size);
829 @@ -3549,12 +3572,26 @@
830 * Release an obj back to its cache. If the obj has a constructed state, it must
831 * be in this state _before_ it is released. Called with disabled ints.
833 -static inline void __cache_free(struct kmem_cache *cachep, void *objp)
834 +static inline void __cache_free(struct kmem_cache *cachep, void *objp, void *caller)
836 struct array_cache *ac = cpu_cache_get(cachep);
839 - objp = cache_free_debugcheck(cachep, objp, __builtin_return_address(0));
840 + objp = cache_free_debugcheck(cachep, objp, caller);
841 + #ifdef CONFIG_CHOPSTIX
842 + if (rec_event && objp) {
843 + struct event event;
844 + struct event_spec espec;
846 + espec.reason = 1; /* free */
847 + event.event_data=&espec;
848 + event.task = current;
850 + event.event_type=4;
851 + (*rec_event)(&event, cachep->buffer_size);
855 vx_slab_free(cachep);
857 if (cache_free_alien(cachep, objp))
858 @@ -3651,16 +3688,19 @@
859 __builtin_return_address(0));
861 EXPORT_SYMBOL(kmem_cache_alloc_node);
863 static __always_inline void *
864 __do_kmalloc_node(size_t size, gfp_t flags, int node, void *caller)
866 struct kmem_cache *cachep;
870 cachep = kmem_find_general_cachep(size, flags);
871 if (unlikely(cachep == NULL))
873 - return kmem_cache_alloc_node(cachep, flags, node);
874 + ret = kmem_cache_alloc_node(cachep, flags, node);
879 #ifdef CONFIG_DEBUG_SLAB
880 @@ -3696,6 +3736,7 @@
883 struct kmem_cache *cachep;
886 /* If you want to save a few bytes .text space: replace
888 @@ -3705,9 +3746,10 @@
889 cachep = __find_general_cachep(size, flags);
890 if (unlikely(cachep == NULL))
892 - return __cache_alloc(cachep, flags, caller);
894 + ret = __cache_alloc(cachep, flags, caller);
899 #ifdef CONFIG_DEBUG_SLAB
900 void *__kmalloc(size_t size, gfp_t flags)
901 @@ -3723,10 +3765,17 @@
902 EXPORT_SYMBOL(__kmalloc_track_caller);
905 +#ifdef CONFIG_CHOPSTIX
906 +void *__kmalloc(size_t size, gfp_t flags)
908 + return __do_kmalloc(size, flags, __builtin_return_address(0));
911 void *__kmalloc(size_t size, gfp_t flags)
913 return __do_kmalloc(size, flags, NULL);
916 EXPORT_SYMBOL(__kmalloc);
919 @@ -3792,7 +3841,7 @@
921 local_irq_save(flags);
922 debug_check_no_locks_freed(objp, obj_size(cachep));
923 - __cache_free(cachep, objp);
924 + __cache_free(cachep, objp,__builtin_return_address(0));
925 local_irq_restore(flags);
927 EXPORT_SYMBOL(kmem_cache_free);
928 @@ -3817,7 +3866,7 @@
929 kfree_debugcheck(objp);
930 c = virt_to_cache(objp);
931 debug_check_no_locks_freed(objp, obj_size(c));
932 - __cache_free(c, (void *)objp);
933 + __cache_free(c, (void *)objp,__builtin_return_address(0));
934 local_irq_restore(flags);
936 EXPORT_SYMBOL(kfree);