linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mel Gorman <mgorman@suse.de>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: David Rientjes <rientjes@google.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Christoph Lameter <cl@linux.com>, Miao Xie <miaox@cn.fujitsu.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] cpuset: mm: Reduce large amounts of memory barrier related damage v2
Date: Wed, 7 Mar 2012 11:01:00 +0000	[thread overview]
Message-ID: <20120307110100.GB17697@suse.de> (raw)
In-Reply-To: <20120306145451.8eff82a6.akpm@linux-foundation.org>

On Tue, Mar 06, 2012 at 02:54:51PM -0800, Andrew Morton wrote:
> > > > -static inline void put_mems_allowed(void)
> > > > +/*
> > > > + * If this returns false, the operation that took place after get_mems_allowed
> > > > + * may have failed. It is up to the caller to retry the operation if
> > > > + * appropriate
> > > > + */
> > > > +static inline bool put_mems_allowed(unsigned int seq)
> > > >  {
> > > > -	/*
> > > > -	 * ensure that reading mems_allowed and mempolicy before reducing
> > > > -	 * mems_allowed_change_disable.
> > > > -	 *
> > > > -	 * the write-side task will know that the read-side task is still
> > > > -	 * reading mems_allowed or mempolicy, don't clears old bits in the
> > > > -	 * nodemask.
> > > > -	 */
> > > > -	smp_mb();
> > > > -	--ACCESS_ONCE(current->mems_allowed_change_disable);
> > > > +	return !read_seqcount_retry(&current->mems_allowed_seq, seq);
> > > >  }
> > > >  
> > > >  static inline void set_mems_allowed(nodemask_t nodemask)
> > > 
> > > How come set_mems_allowed() still uses task_lock()?
> > >
> > 
> > Consistency.
> > 
> > The task_lock is taken by kernel/cpuset.c when updating
> > mems_allowed so it is taken here. That said, it is unnecessary to take
> > as the two places where set_mems_allowed is used are not going to be
> > racing. In the unlikely event that set_mems_allowed() gets another user,
> > there is no harm is leaving the task_lock as it is. It's not in a hot
> > path of any description.
> 
> But shouldn't set_mems_allowed() bump mems_allowed_seq?

Yes, it should. It's not necessary with the existing callers but the
"consistency" argument applies. Fixed now.

-- 
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>

  parent reply	other threads:[~2012-03-07 11:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-06 13:27 [PATCH] cpuset: mm: Reduce large amounts of memory barrier related damage v2 Mel Gorman
2012-03-06 20:26 ` Andrew Morton
2012-03-06 22:42   ` Mel Gorman
2012-03-06 22:54     ` Andrew Morton
2012-03-07  9:05       ` Miao Xie
2012-03-07 11:01       ` Mel Gorman [this message]
2012-03-07  9:15 ` Miao Xie
2012-03-07 11:22   ` Mel Gorman
2012-03-08  3:40     ` Miao Xie

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=20120307110100.GB17697@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).