mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "KOSAKI Motohiro" <kosaki.motohiro@jp.fujitsu.com>
To: "Oleg Nesterov" <oleg@redhat.com>
Cc: "Hugh Dickins" <hugh@veritas.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Balbir Singh" <balbir@linux.vnet.ibm.com>,
	"Jay Lan" <jlan@sgi.com>, "Jiri Pirko" <jpirko@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] introduce get_mm_hiwater_xxx(), fix taskstats->hiwater_xxx accounting
Date: Sun, 7 Dec 2008 00:26:37 +0900	[thread overview]
Message-ID: <2f11576a0812060726m141e1dd0rd2890c2fe3fd5484@mail.gmail.com> (raw)
In-Reply-To: <20081204135250.GA5448@redhat.com>

Hi Oleg

> But the difference can be huge. Let's suppose the process has 2 threads
> T1 and T2.
>
> T1 exits, calls update_hiwater_vm(), notices that mm->hiwater_vm must be
> updated, and preempted right before mm->hiwater_vm = new_value.
>
> T2 does free(malloc(A_LOT)) and exits. It sets the correct value for
> ->hiwater_vm which takes A_LOT into account and disappears.
>
> T1 resumes, and "reverts" ->hiwater_vm to the "new_value" which was
> calculated before.
>
> Now, since T1 is the last exiting thread, the whole thread group
> exits and we report the wrong ->hiwater_vm to the userspace.
>
> Yes, this race is unlikely. But there is another reason (perhaps
> not very good) why I tried to remove update_hiwater_xxx() from
> do_exit().

This explain is very good clarification than current patch description, IMHO.
So, if possible, I hope to add it into the patch description.

thanks.

      parent reply	other threads:[~2008-12-06 15:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-03 18:12 Oleg Nesterov
2008-12-03 20:24 ` Hugh Dickins
2008-12-04 13:52   ` Oleg Nesterov
2008-12-05 12:54     ` Hugh Dickins
2008-12-05 18:41       ` Jay Lan
2008-12-06  8:42         ` Balbir Singh
2008-12-06  9:56           ` Hugh Dickins
2008-12-06 10:39             ` Balbir Singh
2008-12-07 16:17               ` Oleg Nesterov
2008-12-07 16:58                 ` Balbir Singh
2008-12-07 17:28                   ` Oleg Nesterov
2008-12-07 17:39                     ` Balbir Singh
2008-12-06 15:26     ` KOSAKI Motohiro [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=2f11576a0812060726m141e1dd0rd2890c2fe3fd5484@mail.gmail.com \
    --to=kosaki.motohiro@jp.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=hugh@veritas.com \
    --cc=jlan@sgi.com \
    --cc=jpirko@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@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

all inboxes | Powered by JetHome®