mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: nagar@watson.ibm.com
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	lse-tech <lse-tech@lists.sourceforge.net>
Subject: Re: [Patch 2/7] Add sysctl for schedstats
Date: Mon, 27 Feb 2006 20:17:47 +1100	[thread overview]
Message-ID: <4402C3BB.7010705@yahoo.com.au> (raw)
In-Reply-To: <1141027923.5785.50.camel@elinux04.optonline.net>

Shailabh Nagar wrote:
> schedstats-sysctl.patch
> 
> Add sysctl option for controlling schedstats collection
> dynamically. Delay accounting leverages schedstats for
> cpu delay statistics.
> 

I'd sort of rather not tie this in with schedstats if possible.
Schedstats adds a reasonable amount of cache footprint and
branches in hot paths. Most of schedstats stuff is something that
hardly anyone will use.

Sure you can share common code though...

>  
> Index: linux-2.6.16-rc4/kernel/sched.c
> ===================================================================
> --- linux-2.6.16-rc4.orig/kernel/sched.c	2006-02-27 01:20:04.000000000 -0500
> +++ linux-2.6.16-rc4/kernel/sched.c	2006-02-27 01:52:52.000000000 -0500
> @@ -382,11 +382,56 @@ static inline void task_rq_unlock(runque
>  }
>  
>  #ifdef CONFIG_SCHEDSTATS
> +
> +int schedstats_sysctl = 0;		/* schedstats turned off by default */

Should be read mostly.

> +static DEFINE_PER_CPU(int, schedstats) = 0;
> +

When the above is in the read mostly section, you won't need this at all.

You don't intend to switch the sysctl with great frequency, do you?

> +static void schedstats_set(int val)
> +{
> +	int i;
> +	static spinlock_t schedstats_lock = SPIN_LOCK_UNLOCKED;
> +
> +	spin_lock(&schedstats_lock);
> +	schedstats_sysctl = val;
> +	for (i = 0; i < NR_CPUS; i++)
> +		per_cpu(schedstats, i) = val;
> +	spin_unlock(&schedstats_lock);
> +}
> +
> +static int __init schedstats_setup_enable(char *str)
> +{
> +	schedstats_sysctl = 1;
> +	schedstats_set(schedstats_sysctl);
> +	return 1;
> +}
> +
> +__setup("schedstats", schedstats_setup_enable);
> +
> +int schedstats_sysctl_handler(ctl_table *table, int write, struct file *filp,
> +			void __user *buffer, size_t *lenp, loff_t *ppos)
> +{
> +	int ret, prev = schedstats_sysctl;
> +	struct task_struct *g, *t;
> +
> +	ret = proc_dointvec(table, write, filp, buffer, lenp, ppos);
> +	if ((ret != 0) || (prev == schedstats_sysctl))
> +		return ret;
> +	if (schedstats_sysctl) {
> +		read_lock(&tasklist_lock);
> +		do_each_thread(g, t) {
> +			memset(&t->sched_info, 0, sizeof(t->sched_info));
> +		} while_each_thread(g, t);
> +		read_unlock(&tasklist_lock);
> +	}
> +	schedstats_set(schedstats_sysctl);

You don't clear the rq's schedstats stuff here.

And clearing this at all is not really needed for the schedstats interface.
You have a timestamp and a set of accumulated values, so it is easy to work
out deltas. So do you need this?

-- 
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com 

  parent reply	other threads:[~2006-02-27  9:17 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-27  7:56 [Patch 0/7] Per-task delay accounting Shailabh Nagar
2006-02-27  8:02 ` [Patch 1/7] timespec diff utility Shailabh Nagar
2006-02-27  8:12   ` [Patch 2/7] Add sysctl for schedstats Shailabh Nagar
2006-02-27  8:52     ` Ingo Molnar
2006-02-27 10:46       ` [Lse-tech] " Balbir Singh
2006-02-27 12:18         ` Arjan van de Ven
2006-02-27 12:29           ` Balbir Singh
2006-02-27 13:06             ` Arjan van de Ven
2006-02-27 16:16               ` Balbir Singh
2006-02-27  9:17     ` Nick Piggin [this message]
2006-02-27  9:41       ` Shailabh Nagar
2006-02-27 12:28         ` Nick Piggin
2006-02-27 19:09       ` [Lse-tech] " Chandra Seetharaman
2006-02-28  0:25         ` Nick Piggin
2006-02-28  1:42           ` chandra seetharaman
2006-03-07 17:26       ` schedstats refinement (was Re: [Lse-tech] Re: [Patch 2/7] Add sysctl for schedstats) Balbir Singh
2006-02-27 17:05     ` [Lse-tech] [Patch 2/7] Add sysctl for schedstats Bryan O'Sullivan
2006-02-27 20:55       ` Shailabh Nagar
2006-02-27 22:26         ` Bryan O'Sullivan
2006-02-27  8:22   ` [Patch 1/7] timespec diff utility Arjan van de Ven
2006-02-27  8:34     ` Shailabh Nagar
2006-02-27  8:37       ` Arjan van de Ven
2006-02-27  8:15 ` [Patch 3/7] delay accounting initial setup Shailabh Nagar
2006-02-27  8:18 ` [Patch 4/7] Add sysctl for delay accounting Shailabh Nagar
2006-02-27  8:26   ` Arjan van de Ven
2006-02-27  8:38     ` Shailabh Nagar
2006-02-27  8:42       ` Arjan van de Ven
2006-02-27  8:59         ` Shailabh Nagar
2006-02-27 11:18           ` [Lse-tech] " Balbir Singh
2006-02-27  9:04         ` Dipankar Sarma
2006-02-27  9:13           ` Arjan van de Ven
2006-02-27 10:11             ` [Lse-tech] " Balbir Singh
2006-02-27 11:24               ` Arjan van de Ven
2006-02-27 12:00                 ` Balbir Singh
2006-02-27 12:23                 ` Srivatsa Vaddagiri
2006-02-27  8:20 ` [Patch 5/7] synchronous block I/O delays Shailabh Nagar
2006-02-27  8:29   ` Arjan van de Ven
2006-02-27  9:13     ` Shailabh Nagar
2006-02-27  9:18       ` Arjan van de Ven
2006-02-27  9:24       ` Arjan van de Ven
2006-02-27 14:18   ` Andi Kleen
2006-02-27 21:31     ` Shailabh Nagar
2006-02-27 22:09     ` Shailabh Nagar
2006-02-27 22:20       ` Andi Kleen
2006-02-28  8:10       ` Arjan van de Ven
2006-02-27  8:22 ` [Patch 6/7] Swapin page fault delays Shailabh Nagar
2006-02-27  8:30   ` Arjan van de Ven
2006-02-27 22:16     ` Shailabh Nagar
2006-02-27  8:31 ` [Patch 7/7] Generic netlink interface (delay accounting) Shailabh Nagar
     [not found]   ` <1141045194.5363.12.camel@localhost.localdomain>
     [not found]     ` <4403608E.1050304@watson.ibm.com>
     [not found]       ` <1141652556.5185.64.camel@localhost.localdomain>
2006-03-06 17:00         ` Shailabh Nagar
2006-03-07 14:38           ` [Lse-tech] " jamal
2006-03-08 21:56             ` Shailabh Nagar
2006-03-09 14:37               ` [UPDATED PATCH] " Balbir Singh
2006-03-09 16:06                 ` Shailabh Nagar
2006-03-10 14:53                 ` jamal
2006-03-10 15:35                   ` jamal
2006-03-10 16:39                   ` Balbir Singh
2006-03-11 13:30                     ` jamal
2006-03-13 16:21                       ` Balbir Singh
2006-02-27  9:10 ` [Patch 0/7] Per-task delay accounting Nick Piggin

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=4402C3BB.7010705@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lse-tech@lists.sourceforge.net \
    --cc=nagar@watson.ibm.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

Powered by JetHome