lkml.org 
[lkml]   [2005]   [Jun]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] enable/disable profiling via proc/sysctl
On Mon, Jun 27, 2005 at 03:13:13PM +0300, Levent Serinol wrote:
> +#ifdef CONFIG_SMP
> +int remove_hash_tables(void)
> +{
> + int cpu;
> +
> +
> + for_each_online_cpu(cpu) {
> + struct page *page;
> +
> + if (per_cpu(cpu_profile_hits, cpu)[0]) {
> + page = virt_to_page(per_cpu(cpu_profile_hits, cpu)[0]);
> + per_cpu(cpu_profile_hits, cpu)[0] = NULL;
> + __free_page(page);
> + }
> + if (per_cpu(cpu_profile_hits, cpu)[1]) {
> + page = virt_to_page(per_cpu(cpu_profile_hits, cpu)[1]);
> + per_cpu(cpu_profile_hits, cpu)[1] = NULL;
> + __free_page(page);
> + }
> + }
> + return -1;

Big problem. Timer interrupts can be firing while this is in progress.
The reason for profile_nop() is so that the code I have running during
timer interrupts (protected by local_irq_save()) runs to completion,
where it will afterward discover the flags or variables set to updated
states. You'll probably have to add more (e.g. memory barriers) since
you can tolerate less once you're dynamically allocating and freeing etc.


On Mon, Jun 27, 2005 at 03:13:13PM +0300, Levent Serinol wrote:
> @@ -560,7 +668,11 @@ static int __init create_proc_profile(vo
> return 0;
> entry->proc_fops = &proc_profile_operations;
> entry->size = (1+prof_len) * sizeof(atomic_t);
> - hotcpu_notifier(profile_cpu_callback, 0);
> +#ifdef CONFIG_HOTPLUG_CPU
> + register_cpu_notifier(&profile_cpu_notifier);
> +#endif
> + profile_params[0] = prof_on;
> + profile_params[1] = prof_shift;
> return 0;
> }
> module_init(create_proc_profile);

hotcpu_notifier() is there to avoid the #ifdef; you shouldn't need to
rearrange that.

Anyway, just keep fixing it up. There should be a few more after this.


-- wli
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-06-27 19:23    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site