All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mel Gorman <mgorman@suse.de>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Miao Xie <miaox@cn.fujitsu.com>,
	David Rientjes <rientjes@google.com>,
	Christoph Lameter <cl@linux.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] cpuset: mm: Reduce large amounts of memory barrier related damage v3
Date: Tue, 27 Mar 2012 13:47:34 +0100	[thread overview]
Message-ID: <20120327124734.GH16573@suse.de> (raw)
In-Reply-To: <1332778852.16159.138.camel@twins>

On Mon, Mar 26, 2012 at 06:20:52PM +0200, Peter Zijlstra wrote:
> > <SNIP>
> > 
> > I think such a change would be better but should also rename the API.
> > If developers see a get_foo type call, they will expect to see a put_foo
> > call or assume it's a bug even though the implementation happens to be ok
> > with that. Any suggestion on what a good new name would be?
> > 
> > How about read_mems_allowed_begin() and read_mems_allowed_retry()?
> > 
> > read_mems_allowed_begin would be a rename of get_mems_allowed().  In an
> > error path, read_mems_allowed_retry() would documented to be *optionally*
> > called when deciding whether to retry the operation or not. In this scheme,
> > !put_mems_allowed would become read_mems_allowed_retry() which might be
> > a bit easier to read overall.
> 
> One:
> 
> git grep -l "\(get\|put\)_mems_allowed" | while read file; do sed -i -e
> 's/\<get_mems_allowed\>/read_mems_allowed_begin/g' -e
> 's/\<put_mems_allowed\>/read_mems_allowed_retry/g' $file; done
> 
> and a few edits later..
> 
> ---
>  include/linux/cpuset.h |   18 +++++++++---------
>  kernel/cpuset.c        |    2 +-
>  mm/filemap.c           |    4 ++--
>  mm/hugetlb.c           |    4 ++--
>  mm/mempolicy.c         |   14 +++++++-------
>  mm/page_alloc.c        |    8 ++++----
>  mm/slab.c              |    4 ++--
>  mm/slub.c              |   16 +++-------------
>  8 files changed, 30 insertions(+), 40 deletions(-)
> 
> diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
> index 7a7e5fd..d008b03 100644
> --- a/include/linux/cpuset.h
> +++ b/include/linux/cpuset.h
> @@ -89,25 +89,25 @@ extern void rebuild_sched_domains(void);
>  extern void cpuset_print_task_mems_allowed(struct task_struct *p);
>  
>  /*
> - * get_mems_allowed is required when making decisions involving mems_allowed
> + * read_mems_allowed_begin is required when making decisions involving mems_allowed
>   * such as during page allocation. mems_allowed can be updated in parallel
>   * and depending on the new value an operation can fail potentially causing
> - * process failure. A retry loop with get_mems_allowed and put_mems_allowed
> + * process failure. A retry loop with read_mems_allowed_begin and read_mems_allowed_retry
>   * prevents these artificial failures.
>   */

Going over 80 columns there. This happens in other places in the patch
but the alternative in those cases is less readable.

> -static inline unsigned int get_mems_allowed(void)
> +static inline unsigned int read_mems_allowed_begin(void)
>  {
>  	return read_seqcount_begin(&current->mems_allowed_seq);
>  }
>  
>  /*
> - * If this returns false, the operation that took place after get_mems_allowed
> + * If this returns false, the operation that took place after read_mems_allowed_begin
>   * may have failed. It is up to the caller to retry the operation if
>   * appropriate.
>   */

80 cols again and it should be "returns true". Something like this?

/*
 * If this returns true, the operation that took place after 
 * read_mems_allowed_begin may have failed artifically due to a paralle
 * update of mems_allowed. It is up to the caller to retry the operation
 * if appropriate.
 */

Other than that, the changes looked good and I agree that it is better
overall.

Acked-by: Mel Gorman <mgorman@suse.de>

-- 
Mel Gorman
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Mel Gorman <mgorman@suse.de>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Miao Xie <miaox@cn.fujitsu.com>,
	David Rientjes <rientjes@google.com>,
	Christoph Lameter <cl@linux.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] cpuset: mm: Reduce large amounts of memory barrier related damage v3
Date: Tue, 27 Mar 2012 13:47:34 +0100	[thread overview]
Message-ID: <20120327124734.GH16573@suse.de> (raw)
In-Reply-To: <1332778852.16159.138.camel@twins>

On Mon, Mar 26, 2012 at 06:20:52PM +0200, Peter Zijlstra wrote:
> > <SNIP>
> > 
> > I think such a change would be better but should also rename the API.
> > If developers see a get_foo type call, they will expect to see a put_foo
> > call or assume it's a bug even though the implementation happens to be ok
> > with that. Any suggestion on what a good new name would be?
> > 
> > How about read_mems_allowed_begin() and read_mems_allowed_retry()?
> > 
> > read_mems_allowed_begin would be a rename of get_mems_allowed().  In an
> > error path, read_mems_allowed_retry() would documented to be *optionally*
> > called when deciding whether to retry the operation or not. In this scheme,
> > !put_mems_allowed would become read_mems_allowed_retry() which might be
> > a bit easier to read overall.
> 
> One:
> 
> git grep -l "\(get\|put\)_mems_allowed" | while read file; do sed -i -e
> 's/\<get_mems_allowed\>/read_mems_allowed_begin/g' -e
> 's/\<put_mems_allowed\>/read_mems_allowed_retry/g' $file; done
> 
> and a few edits later..
> 
> ---
>  include/linux/cpuset.h |   18 +++++++++---------
>  kernel/cpuset.c        |    2 +-
>  mm/filemap.c           |    4 ++--
>  mm/hugetlb.c           |    4 ++--
>  mm/mempolicy.c         |   14 +++++++-------
>  mm/page_alloc.c        |    8 ++++----
>  mm/slab.c              |    4 ++--
>  mm/slub.c              |   16 +++-------------
>  8 files changed, 30 insertions(+), 40 deletions(-)
> 
> diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
> index 7a7e5fd..d008b03 100644
> --- a/include/linux/cpuset.h
> +++ b/include/linux/cpuset.h
> @@ -89,25 +89,25 @@ extern void rebuild_sched_domains(void);
>  extern void cpuset_print_task_mems_allowed(struct task_struct *p);
>  
>  /*
> - * get_mems_allowed is required when making decisions involving mems_allowed
> + * read_mems_allowed_begin is required when making decisions involving mems_allowed
>   * such as during page allocation. mems_allowed can be updated in parallel
>   * and depending on the new value an operation can fail potentially causing
> - * process failure. A retry loop with get_mems_allowed and put_mems_allowed
> + * process failure. A retry loop with read_mems_allowed_begin and read_mems_allowed_retry
>   * prevents these artificial failures.
>   */

Going over 80 columns there. This happens in other places in the patch
but the alternative in those cases is less readable.

> -static inline unsigned int get_mems_allowed(void)
> +static inline unsigned int read_mems_allowed_begin(void)
>  {
>  	return read_seqcount_begin(&current->mems_allowed_seq);
>  }
>  
>  /*
> - * If this returns false, the operation that took place after get_mems_allowed
> + * If this returns false, the operation that took place after read_mems_allowed_begin
>   * may have failed. It is up to the caller to retry the operation if
>   * appropriate.
>   */

80 cols again and it should be "returns true". Something like this?

/*
 * If this returns true, the operation that took place after 
 * read_mems_allowed_begin may have failed artifically due to a paralle
 * update of mems_allowed. It is up to the caller to retry the operation
 * if appropriate.
 */

Other than that, the changes looked good and I agree that it is better
overall.

Acked-by: Mel Gorman <mgorman@suse.de>

-- 
Mel Gorman
SUSE Labs

  reply	other threads:[~2012-03-27 12:47 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-07 18:08 [PATCH] cpuset: mm: Reduce large amounts of memory barrier related damage v3 Mel Gorman
2012-03-07 18:08 ` Mel Gorman
2012-03-26 10:56 ` Peter Zijlstra
2012-03-26 10:56   ` Peter Zijlstra
2012-03-26 11:07   ` Peter Zijlstra
2012-03-26 11:07     ` Peter Zijlstra
2012-03-26 15:50   ` Mel Gorman
2012-03-26 15:50     ` Mel Gorman
2012-03-26 16:20     ` Peter Zijlstra
2012-03-26 16:20       ` Peter Zijlstra
2012-03-27 12:47       ` Mel Gorman [this message]
2012-03-27 12:47         ` Mel Gorman
2012-03-27 13:14         ` [PATCH] mm: Optimize put_mems_allowed() usage Peter Zijlstra
2012-03-27 13:14           ` Peter Zijlstra
2012-05-17 10:33           ` Peter Zijlstra
2012-05-17 10:33             ` Peter Zijlstra
2012-05-17 20:16           ` Andrew Morton
2012-05-17 20:16             ` Andrew Morton
2012-05-17 20:23             ` Peter Zijlstra
2012-05-17 20:23               ` Peter Zijlstra
2012-05-18 10:20   ` [tip:sched/numa] " tip-bot for Peter Zijlstra
2013-08-23 13:03 ` [PATCH] cpuset: mm: Reduce large amounts of memory barrier related damage v3 Peter Zijlstra
2013-08-23 13:03   ` Peter Zijlstra
2013-08-23 18:15   ` Peter Zijlstra
2013-08-23 18:15     ` Peter Zijlstra
2013-08-26  5:32     ` Rik van Riel
2013-08-26  5:32       ` Rik van Riel
2013-08-29  9:28     ` Mel Gorman
2013-08-29  9:28       ` Mel Gorman
2013-08-29  9:43       ` Peter Zijlstra
2013-08-29  9:43         ` Peter Zijlstra
2013-08-29  9:45         ` Peter Zijlstra
2013-08-29  9:45           ` Peter Zijlstra
2013-08-29 10:56         ` Mel Gorman
2013-08-29 10:56           ` Mel Gorman
2013-08-29 11:14           ` Peter Zijlstra
2013-08-29 11:14             ` Peter Zijlstra
2013-08-29 12:10             ` Mel Gorman
2013-08-29 12:10               ` Mel Gorman

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=20120327124734.GH16573@suse.de \
    --to=mgorman@suse.de \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=miaox@cn.fujitsu.com \
    --cc=rientjes@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.