linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Zi Yan <ziy@nvidia.com>
To: "Huang, Ying" <ying.huang@intel.com>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	"Andrea Arcangeli" <aarcange@redhat.com>,
	"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
	"Vlastimil Babka" <vbabka@suse.cz>,
	"Alexey Dobriyan" <adobriyan@gmail.com>,
	"Michal Hocko" <mhocko@suse.com>,
	"Konstantin Khlebnikov" <khlebnikov@yandex-team.ru>,
	"Jérôme Glisse" <jglisse@redhat.com>,
	"Yang Shi" <yang.shi@linux.alibaba.com>
Subject: Re: [PATCH] /proc/PID/smaps: Add PMD migration entry parsing
Date: Tue, 31 Mar 2020 22:42:06 -0400	[thread overview]
Message-ID: <C497B0EF-1B3A-4E4E-8888-D74B2CEFE2B3@nvidia.com> (raw)
In-Reply-To: <87r1x8hrie.fsf@yhuang-dev.intel.com>

[-- Attachment #1: Type: text/plain, Size: 2470 bytes --]

On 31 Mar 2020, at 22:24, Huang, Ying wrote:

> External email: Use caution opening links or attachments
>
>
> Zi Yan <ziy@nvidia.com> writes:
>
>> On 31 Mar 2020, at 4:56, Huang, Ying wrote:
>>>
>>> From: Huang Ying <ying.huang@intel.com>
>>>
>>> Now, when read /proc/PID/smaps, the PMD migration entry in page table is simply
>>> ignored.  To improve the accuracy of /proc/PID/smaps, its parsing and processing
>>> is added.
>>>
>>> Signed-off-by: "Huang, Ying" <ying.huang@intel.com>
>>> Cc: Andrea Arcangeli <aarcange@redhat.com>
>>> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
>>> Cc: Zi Yan <ziy@nvidia.com>
>>> Cc: Vlastimil Babka <vbabka@suse.cz>
>>> Cc: Alexey Dobriyan <adobriyan@gmail.com>
>>> Cc: Michal Hocko <mhocko@suse.com>
>>> Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
>>> Cc: "Jérôme Glisse" <jglisse@redhat.com>
>>> Cc: Yang Shi <yang.shi@linux.alibaba.com>
>>> ---
>>>  fs/proc/task_mmu.c | 16 ++++++++++++----
>>>  1 file changed, 12 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
>>> index 8d382d4ec067..b5b3aef8cb3b 100644
>>> --- a/fs/proc/task_mmu.c
>>> +++ b/fs/proc/task_mmu.c
>>> @@ -548,8 +548,17 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr,
>>>         bool locked = !!(vma->vm_flags & VM_LOCKED);
>>>         struct page *page;
>>
>> Like Konstantin pointed out in another email, you could initialize page to NULL here.
>> Plus you do not need the “else-return” below, if you do that.
>
> Yes.  That looks better.  Will change this in the next version.

Thanks.

>
>>>
>>> -       /* FOLL_DUMP will return -EFAULT on huge zero page */
>>> -       page = follow_trans_huge_pmd(vma, addr, pmd, FOLL_DUMP);
>>> +       if (pmd_present(*pmd)) {
>>> +               /* FOLL_DUMP will return -EFAULT on huge zero page */
>>> +               page = follow_trans_huge_pmd(vma, addr, pmd, FOLL_DUMP);
>>> +       } else if (unlikely(is_swap_pmd(*pmd))) {
>>
>> Should be:
>>           } else if (unlikely(thp_migration_support() && is_swap_pmd(*pmd))) {
>>
>> Otherwise, when THP migration is disabled and the PMD is under splitting, VM_BUG_ON
>> will be triggered.
>
> We hold the PMD page table lock when call smaps_pmd_entry().  How does
> PMD splitting trigger VM_BUG_ON()?

Oh, I missed that. Your original code is right. Thank you for the explanation.



—
Best Regards,
Yan Zi

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 854 bytes --]

  reply	other threads:[~2020-04-01  2:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-31  8:56 Huang, Ying
2020-03-31  9:51 ` Konstantin Khlebnikov
2020-04-01  2:31   ` Huang, Ying
2020-04-01  6:03     ` Konstantin Khlebnikov
2020-04-01  6:20       ` Huang, Ying
2020-03-31 12:24 ` Zi Yan
2020-04-01  2:24   ` Huang, Ying
2020-04-01  2:42     ` Zi Yan [this message]
2020-04-02  1:49   ` Huang, Ying
2020-04-01 23:04 ` Andrew Morton
2020-04-02  1:42   ` Huang, Ying
2020-04-02  6:27   ` Michal Hocko

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=C497B0EF-1B3A-4E4E-8888-D74B2CEFE2B3@nvidia.com \
    --to=ziy@nvidia.com \
    --cc=aarcange@redhat.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=jglisse@redhat.com \
    --cc=khlebnikov@yandex-team.ru \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=vbabka@suse.cz \
    --cc=yang.shi@linux.alibaba.com \
    --cc=ying.huang@intel.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