public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: William Lee Irwin III <wli@holomorphy.com>
To: Levent Serinol <lserinol@gmail.com>
Cc: Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org, riel@redhat.com
Subject: Re: [PATCH] enable/disable profiling via proc/sysctl
Date: Mon, 27 Jun 2005 05:56:49 -0700	[thread overview]
Message-ID: <20050627125649.GJ3334@holomorphy.com> (raw)
In-Reply-To: <2c1942a7050627051357e9b532@mail.gmail.com>

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

  reply	other threads:[~2005-06-27 14:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-27  6:41 [PATCH] enable/disable profiling via proc/sysctl Levent Serinol
2005-06-27  7:01 ` Andrew Morton
2005-06-27 12:13   ` Levent Serinol
2005-06-27 12:56     ` William Lee Irwin III [this message]
2005-06-27 15:40       ` Levent Serinol

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050627125649.GJ3334@holomorphy.com \
    --to=wli@holomorphy.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lserinol@gmail.com \
    --cc=riel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox