public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Davidlohr Bueso <dave@stgolabs.net>
To: Iulia Manda <iulia.manda21@gmail.com>
Cc: linux-kernel@vger.kernel.org, riel@redhat.com, mingo@redhat.com,
	peterz@infradead.org, mgorman@suse.de
Subject: Re: [PATCH] kernel: Refactor task_struct to use numa_faults instead of numa_* pointers
Date: Thu, 30 Oct 2014 14:42:08 -0700	[thread overview]
Message-ID: <1414705328.1821.7.camel@linux-t7sj.site> (raw)
In-Reply-To: <20141030193817.GA17859@winterfell>

On Thu, 2014-10-30 at 21:38 +0200, Iulia Manda wrote:
> This patch simplifies task_struct by removing the four numa_* pointers
> in the same array and replacing them with the array pointer. By doing this,
> the size of task_struct is reduced.

This is always welcome, but for completeness you should specify by how
much on <insert your favorite arch>. afaict you're removing 3 ulong
pointers.

> A new parameter is added to the task_faults_idx function so that it can return
> an index to the correct offset, corresponding with the old precalculated
> pointers.
> 
> All of the code in sched/ that depended on task_faults_idx and numa_* was
> changed in order to match the new logic.
> 
> Signed-off-by: Iulia Manda <iulia.manda21@gmail.com>

Acked-by: Davidlohr Bueso <dave@stgolabs.net>

With some suggestions below.

> ---
>  include/linux/sched.h |   40 ++++++++++--------
>  kernel/sched/core.c   |    3 +-
>  kernel/sched/debug.c  |    4 +-
>  kernel/sched/fair.c   |  110 +++++++++++++++++++++++++------------------------
>  4 files changed, 82 insertions(+), 75 deletions(-)
> 
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index 5e344bb..bf8c19f 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -796,6 +796,15 @@ struct sched_info {
>  };
>  #endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */
>  
> +#ifdef CONFIG_NUMA_BALANCING
> +enum numa_faults_stats {
> +	NUMA_MEM = 0,
> +	NUMA_CPU,
> +	NUMA_MEMBUF,
> +	NUMA_CPUBUF
> +};
> +#endif
> +
>  #ifdef CONFIG_TASK_DELAY_ACCT
>  struct task_delay_info {
>  	spinlock_t	lock;
> @@ -1558,28 +1567,23 @@ struct task_struct {
>  	struct numa_group *numa_group;
>  
>  	/*
> -	 * Exponential decaying average of faults on a per-node basis.
> -	 * Scheduling placement decisions are made based on the these counts.
> -	 * The values remain static for the duration of a PTE scan
> +	 * numa_faults is an array split into four regions:
> +	 * faults_memory, faults_cpu, faults_memory_buffer, faults_cpu_buffer
> +	 * in this precise order.
> +	 *
> +	 * faults_memory: Exponential decaying average of faults on a per-node
> +	 * basis. Scheduling placement decisions are made based on these
> +	 * counts. The values remain static for the duration of a PTE scan.
> +	 * faults_cpu: Track the nodes the process was running on when a NUMA
> +	 * hinting fault was incurred.
> +	 * faults_memory_buffer and faults_cpu_buffer: Record faults per node
> +	 * during the current scan window. When the scan completes, the counts
> +	 * in faults_memory and faults_cpu decay and these values are copied.

How about moving these comments to where you have the enum
numa_faults_stats? And just point to that here.

[...]
> -static inline int task_faults_idx(int nid, int priv)
> +/*
> + * The averaged statistics, shared & private, memory & cpu,
> + * occupy the first half of the array. The second half of the
> + * array is for current counters, which are averaged into the
> + * first set by task_numa_placement.
> + */
> +static inline int task_faults_idx(enum numa_faults_stats s, int nid, int priv)
>  {
> -	return NR_NUMA_HINT_FAULT_TYPES * nid + priv;
> +	return s * NR_NUMA_HINT_FAULT_TYPES * nr_node_ids +
> +		NR_NUMA_HINT_FAULT_TYPES * nid + priv;

parenthesis here?

Thanks,
Davidlohr


      parent reply	other threads:[~2014-10-30 21:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-30 19:38 [PATCH] kernel: Refactor task_struct to use numa_faults instead of numa_* pointers Iulia Manda
2014-10-30 19:44 ` Rik van Riel
2014-10-30 19:50 ` Peter Zijlstra
2014-10-30 21:42 ` Davidlohr Bueso [this message]

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=1414705328.1821.7.camel@linux-t7sj.site \
    --to=dave@stgolabs.net \
    --cc=iulia.manda21@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --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