From: Miao Xie <miaox@cn.fujitsu.com>
To: Nick Piggin <npiggin@suse.de>
Cc: Lee Schermerhorn <lee.schermerhorn@hp.com>,
David Rientjes <rientjes@google.com>,
Paul Menage <menage@google.com>,
Linux-Kernel <linux-kernel@vger.kernel.org>,
Linux-MM <linux-mm@kvack.org>
Subject: Re: [PATCH 1/4] cpuset: fix the problem that cpuset_mem_spread_node() returns an offline node(was: Re: [regression] cpuset,mm: update tasks' mems_allowed in time (58568d2))
Date: Thu, 04 Mar 2010 17:31:19 +0800 [thread overview]
Message-ID: <4B8F7DE7.1050705@cn.fujitsu.com> (raw)
In-Reply-To: <20100304032209.GM8653@laptop>
on 2010-3-4 11:22, Nick Piggin wrote:
...
>> + /*
>> + * After current->mems_allowed is set to a new value, current will
>> + * allocate new pages for the migrating memory region. So we must
>> + * ensure that update of current->mems_allowed have been completed
>> + * by this moment.
>> + */
>> + smp_wmb();
>> do_migrate_pages(mm, from, to, MPOL_MF_MOVE_ALL);
>>
>> guarantee_online_mems(task_cs(tsk),&tsk->mems_allowed);
>> +
>> + /*
>> + * After doing migrate pages, current will allocate new pages for
>> + * itself not the other tasks. So we must ensure that update of
>> + * current->mems_allowed have been completed by this moment.
>> + */
>> + smp_wmb();
>
> The comments don't really make sense. A task always sees its own
> memory operations in program order. You keep saying *current* allocates
> pages so *current*->mems_allowed must be updated. This doesn't make
> sense. Do you mean to say tsk->?
>
> Secondly, memory ordering operations do not ensure anything is
> completed. They only ensure ordering. So to make sense to use them,
> you generally need corresponding barriers in other code that can
> run concurrently.
>
> So you need to comment what is being ordered (ie. at least 2 memory
> operations). And what other code might be running that requires this
> ordering.
>
> You need to comment to all these sites and operations. Sprinkling of
> memory barriers just gets unmaintainable.
My thought is wrong.
I thought the kernel might call do_migrate_pages() before updating
->mems_allowed, so I used smp_wmb() to ensure this order.
In fact, this problem which I worried can't occur, so these smp_wmb()
is unnecessary.
Thanks!
Miao
WARNING: multiple messages have this Message-ID (diff)
From: Miao Xie <miaox@cn.fujitsu.com>
To: Nick Piggin <npiggin@suse.de>
Cc: Lee Schermerhorn <lee.schermerhorn@hp.com>,
David Rientjes <rientjes@google.com>,
Paul Menage <menage@google.com>,
Linux-Kernel <linux-kernel@vger.kernel.org>,
Linux-MM <linux-mm@kvack.org>
Subject: Re: [PATCH 1/4] cpuset: fix the problem that cpuset_mem_spread_node() returns an offline node(was: Re: [regression] cpuset,mm: update tasks' mems_allowed in time (58568d2))
Date: Thu, 04 Mar 2010 17:31:19 +0800 [thread overview]
Message-ID: <4B8F7DE7.1050705@cn.fujitsu.com> (raw)
In-Reply-To: <20100304032209.GM8653@laptop>
on 2010-3-4 11:22, Nick Piggin wrote:
...
>> + /*
>> + * After current->mems_allowed is set to a new value, current will
>> + * allocate new pages for the migrating memory region. So we must
>> + * ensure that update of current->mems_allowed have been completed
>> + * by this moment.
>> + */
>> + smp_wmb();
>> do_migrate_pages(mm, from, to, MPOL_MF_MOVE_ALL);
>>
>> guarantee_online_mems(task_cs(tsk),&tsk->mems_allowed);
>> +
>> + /*
>> + * After doing migrate pages, current will allocate new pages for
>> + * itself not the other tasks. So we must ensure that update of
>> + * current->mems_allowed have been completed by this moment.
>> + */
>> + smp_wmb();
>
> The comments don't really make sense. A task always sees its own
> memory operations in program order. You keep saying *current* allocates
> pages so *current*->mems_allowed must be updated. This doesn't make
> sense. Do you mean to say tsk->?
>
> Secondly, memory ordering operations do not ensure anything is
> completed. They only ensure ordering. So to make sense to use them,
> you generally need corresponding barriers in other code that can
> run concurrently.
>
> So you need to comment what is being ordered (ie. at least 2 memory
> operations). And what other code might be running that requires this
> ordering.
>
> You need to comment to all these sites and operations. Sprinkling of
> memory barriers just gets unmaintainable.
My thought is wrong.
I thought the kernel might call do_migrate_pages() before updating
->mems_allowed, so I used smp_wmb() to ensure this order.
In fact, this problem which I worried can't occur, so these smp_wmb()
is unnecessary.
Thanks!
Miao
--
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>
next prev parent reply other threads:[~2010-03-04 9:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-03 10:44 [PATCH 1/4] cpuset: fix the problem that cpuset_mem_spread_node() returns an offline node(was: Re: [regression] cpuset,mm: update tasks' mems_allowed in time (58568d2)) Miao Xie
2010-03-03 10:44 ` Miao Xie
2010-03-04 3:22 ` Nick Piggin
2010-03-04 3:22 ` Nick Piggin
2010-03-04 9:31 ` Miao Xie [this message]
2010-03-04 9:31 ` 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=4B8F7DE7.1050705@cn.fujitsu.com \
--to=miaox@cn.fujitsu.com \
--cc=lee.schermerhorn@hp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=menage@google.com \
--cc=npiggin@suse.de \
--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.