linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Lameter <cl@linux.com>
To: Jianyu Zhan <nasa4836@gmail.com>
Cc: akpm@linux-foundation.org, hughd@google.com, riel@redhat.com,
	mgorman@suse.de, zhangyanfei@cn.fujitsu.com, aarcange@redhat.com,
	fabf@skynet.be, sasha.levin@oracle.com, oleg@redhat.com,
	n-horiguchi@ah.jp.nec.com, iamjoonsoo.kim@lge.com,
	kirill.shutemov@linux.intel.com, gorcunov@gmail.com,
	dave.hansen@linux.intel.com, toshi.kani@hp.com,
	paul.gortmaker@windriver.com, srivatsa.bhat@linux.vnet.ibm.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] mm: add comment for __mod_zone_page_stat
Date: Mon, 12 May 2014 09:01:41 -0500 (CDT)	[thread overview]
Message-ID: <alpine.DEB.2.10.1405120858040.3090@gentwo.org> (raw)
In-Reply-To: <1399811500-14472-1-git-send-email-nasa4836@gmail.com>

On Sun, 11 May 2014, Jianyu Zhan wrote:

> >
> >/*
> > * For use when we know that interrupts are disabled,
> > * or when we know that preemption is disabled and that
> > * particular counter cannot be updated from interrupt context.
> > */
>
>  Seconded. Christoph, would you please write a comment? I've written
>  a new one based on Hugh's, would you please also take a look? Thanks.

The description above looks ok to me. The problem is that you are
considering the page related data structures as an issue for races and not
the data structures relevant for vm statistics.

> It is essential to have such gurantees, because __mod_zone_page_stat()
> is a two-step operation : read-percpu-couter-then-modify-it.
> (Need comments. Christoph, do I misunderstand it?)

Yup.

> mlocked_vma_newpage() is only called in fault path by
> page_add_new_anon_rmap(), which is called on a *new* page.
> And such page is initially only visible via the pagetables, and the
> pte is locked while calling page_add_new_anon_rmap(), so we need not
> use an irq-safe mod_zone_page_state() here, using a light-weight version
> __mod_zone_page_state() would be OK.

This is wrong.. What you could say is that preemption is off and that the
counter is never incremented from an interrupt context that could race
with it. If this is the case then it would be safe.

--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2014-05-12 14:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-11 12:31 Jianyu Zhan
2014-05-12 14:01 ` Christoph Lameter [this message]
2014-05-12 15:19   ` Jianyu Zhan
2014-05-12 16:05     ` Christoph Lameter
2014-05-12 16:07     ` Christoph Lameter
  -- strict thread matches above, loose matches on Subject: below --
2014-05-12 17:36 Jianyu Zhan
2014-05-12 16:33 Jianyu Zhan
2014-05-12 16:57 ` Christoph Lameter
2014-05-14  3:59 ` Hugh Dickins
2014-05-10  7:15 Jianyu Zhan
2014-05-10 19:51 ` Hugh Dickins

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=alpine.DEB.2.10.1405120858040.3090@gentwo.org \
    --to=cl@linux.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=fabf@skynet.be \
    --cc=gorcunov@gmail.com \
    --cc=hughd@google.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=nasa4836@gmail.com \
    --cc=oleg@redhat.com \
    --cc=paul.gortmaker@windriver.com \
    --cc=riel@redhat.com \
    --cc=sasha.levin@oracle.com \
    --cc=srivatsa.bhat@linux.vnet.ibm.com \
    --cc=toshi.kani@hp.com \
    --cc=zhangyanfei@cn.fujitsu.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