From: Pan Zhang <zhangpan26@huawei.com>
To: <akpm@linux-foundation.org>, <vbabka@suse.cz>,
<rientjes@google.com>, <mhocko@suse.com>, <jgg@ziepe.ca>,
<aarcange@redhat.com>, <yang.shi@linux.alibaba.com>,
<zhongjiang@huawei.com>
Cc: <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>
Subject: Re: Re: [PATCH] mm: mempolicy: fix the absence of the last bit of nodemask
Date: Mon, 14 Oct 2019 21:49:25 +0800 [thread overview]
Message-ID: <1571060965-17794-1-git-send-email-zhangpan26@huawei.com> (raw)
In-Reply-To: <e91614fa-4fc4-5e66-e8a9-3eede916e71f@suse.cz>
On Mon 14-10:19 17:12:52, Michal Hocko wrote:
>> When I want to use set_mempolicy to get the memory from each node on the numa machine,
>> and the MPOL_INTERLEAVE flag seems to achieve this goal.
>> However, during the test, it was found that the use result of node was unbalanced.
>> The memory was allocated evenly from the nodes except the last node,
>> which obviously did not match the expectations.
>>
>> You can test as follows:
>> 1. Create a file that needs to be mmap ped:
>> dd if=/dev/zero of=./test count=1024 bs=1M
>This will already poppulate the page cache and if it fits into memory (which seems to be the case in your example output) then your mmap later will not allocate any new memory.
>
>I suspect that using numactl --interleave 0,1 dd if=/dev/zero of=./test count=1024 bs=1M
>
>will produce an output much closer to your expectation. Right?
Yes, you are right. `dd` command will 'populate the page cache and if it fits into memory'.
As a newcomer who is studying hard in this field,
I am sorry for this and I don't know much about the mechanism of memory management.
I used `malloc` again in my program to allocate memory and produced the same `confusing` result.
But as you and Vlastimil Babka said, historical reasons have made the implementation of this interface less intuitive.
Modifying manual may be a better option.
Thank you both for your reply and explanation.
prev parent reply other threads:[~2019-10-14 13:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-12 12:19 Pan Zhang
2019-10-14 9:12 ` Michal Hocko
2019-10-14 9:35 ` Vlastimil Babka
2019-10-14 13:49 ` Pan Zhang [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=1571060965-17794-1-git-send-email-zhangpan26@huawei.com \
--to=zhangpan26@huawei.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=jgg@ziepe.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=rientjes@google.com \
--cc=vbabka@suse.cz \
--cc=yang.shi@linux.alibaba.com \
--cc=zhongjiang@huawei.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