From: "Huang\, Ying" <ying.huang@intel.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Michal Hocko <mhocko@suse.com>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Andrei Vagin <avagin@openvz.org>,
Dan Williams <dan.j.williams@intel.com>,
Jerome Glisse <jglisse@redhat.com>,
Daniel Colascione <dancol@google.com>,
Zi Yan <zi.yan@cs.rutgers.edu>,
Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Subject: Re: [PATCH -mm] mm, pagemap: Fix swap offset value for PMD migration entry
Date: Tue, 10 Apr 2018 09:28:54 +0800 [thread overview]
Message-ID: <87fu43lui1.fsf@yhuang-dev.intel.com> (raw)
In-Reply-To: <20180408033737.10897-1-ying.huang@intel.com> (Ying Huang's message of "Sun, 8 Apr 2018 11:37:37 +0800")
Hi, Andrew,
"Huang, Ying" <ying.huang@intel.com> writes:
> From: Huang Ying <ying.huang@intel.com>
>
> The swap offset reported by /proc/<pid>/pagemap may be not correct for
> PMD migration entry. If addr passed into pagemap_range() isn't
> aligned with PMD start address, the swap offset reported doesn't
> reflect this. And in the loop to report information of each sub-page,
> the swap offset isn't increased accordingly as that for PFN.
>
> BTW: migration swap entries have PFN information, do we need to
> restrict whether to show them?
>
> Signed-off-by: "Huang, Ying" <ying.huang@intel.com>
> Cc: Michal Hocko <mhocko@suse.com>
> Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
> Cc: Andrei Vagin <avagin@openvz.org>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Cc: "Jerome Glisse" <jglisse@redhat.com>
> Cc: Daniel Colascione <dancol@google.com>
> Cc: Zi Yan <zi.yan@cs.rutgers.edu>
> Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> ---
> fs/proc/task_mmu.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
> index 65ae54659833..757e748da613 100644
> --- a/fs/proc/task_mmu.c
> +++ b/fs/proc/task_mmu.c
> @@ -1310,9 +1310,11 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end,
> #ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION
> else if (is_swap_pmd(pmd)) {
> swp_entry_t entry = pmd_to_swp_entry(pmd);
> + unsigned long offset = swp_offset(entry);
>
> + offset += (addr & ~PMD_MASK) >> PAGE_SHIFT;
> frame = swp_type(entry) |
> - (swp_offset(entry) << MAX_SWAPFILES_SHIFT);
> + (offset << MAX_SWAPFILES_SHIFT);
> flags |= PM_SWAP;
> if (pmd_swp_soft_dirty(pmd))
> flags |= PM_SOFT_DIRTY;
> @@ -1332,6 +1334,8 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end,
> break;
> if (pm->show_pfn && (flags & PM_PRESENT))
> frame++;
> + else if (flags | PM_SWAP)
Oops, I just found a typo here, it should be,
+ else if (flags & PM_SWAP)
Sorry about that. Do I need to refresh the patch or you will fix it
inline?
Best Regards,
Huang, Ying
> + frame += (1 << MAX_SWAPFILES_SHIFT);
> }
> spin_unlock(ptl);
> return err;
prev parent reply other threads:[~2018-04-10 1:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-08 3:37 [PATCH -mm] mm, pagemap: Fix swap offset value for PMD migration entry Huang, Ying
2018-04-10 0:47 ` Andrew Morton
2018-04-10 0:57 ` Huang, Ying
2018-04-10 11:12 ` Kirill A. Shutemov
2018-04-11 0:56 ` Huang, Ying
2018-04-10 1:28 ` Huang, Ying [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=87fu43lui1.fsf@yhuang-dev.intel.com \
--to=ying.huang@intel.com \
--cc=akpm@linux-foundation.org \
--cc=avagin@openvz.org \
--cc=dan.j.williams@intel.com \
--cc=dancol@google.com \
--cc=jglisse@redhat.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=n-horiguchi@ah.jp.nec.com \
--cc=zi.yan@cs.rutgers.edu \
/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;
as well as URLs for NNTP newsgroup(s).