* + mm-gup-fix-potential-pgmap-refcnt-leak-in-__gup_device_huge-fix-fix.patch added to -mm tree
@ 2021-08-07 18:46 akpm
2021-08-08 21:12 ` John Hubbard
2021-08-09 1:52 ` Miaohe Lin
0 siblings, 2 replies; 3+ messages in thread
From: akpm @ 2021-08-07 18:46 UTC (permalink / raw)
To: mm-commits, linmiaohe, kirill.shutemov, jhubbard, jack, imbrenda, akpm
The patch titled
Subject: mm-gup-fix-potential-pgmap-refcnt-leak-in-__gup_device_huge-fix-fix
has been added to the -mm tree. Its filename is
mm-gup-fix-potential-pgmap-refcnt-leak-in-__gup_device_huge-fix-fix.patch
This patch should soon appear at
https://ozlabs.org/~akpm/mmots/broken-out/mm-gup-fix-potential-pgmap-refcnt-leak-in-__gup_device_huge-fix-fix.patch
and later at
https://ozlabs.org/~akpm/mmotm/broken-out/mm-gup-fix-potential-pgmap-refcnt-leak-in-__gup_device_huge-fix-fix.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: Andrew Morton <akpm@linux-foundation.org>
Subject: mm-gup-fix-potential-pgmap-refcnt-leak-in-__gup_device_huge-fix-fix
fix return value
Cc: Claudio Imbrenda <imbrenda@linux.ibm.com>
Cc: Jan Kara <jack@suse.cz>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/gup.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/mm/gup.c~mm-gup-fix-potential-pgmap-refcnt-leak-in-__gup_device_huge-fix-fix
+++ a/mm/gup.c
@@ -2240,6 +2240,7 @@ static int __gup_device_huge(unsigned lo
{
int nr_start = *nr;
struct dev_pagemap *pgmap = NULL;
+ int ret = 1;
do {
struct page *page = pfn_to_page(pfn);
@@ -2247,12 +2248,14 @@ static int __gup_device_huge(unsigned lo
pgmap = get_dev_pagemap(pfn, pgmap);
if (unlikely(!pgmap)) {
undo_dev_pagemap(nr, nr_start, flags, pages);
+ ret = 0;
break;
}
SetPageReferenced(page);
pages[*nr] = page;
if (unlikely(!try_grab_page(page, flags))) {
undo_dev_pagemap(nr, nr_start, flags, pages);
+ ret = 0;
break;
}
(*nr)++;
@@ -2260,7 +2263,7 @@ static int __gup_device_huge(unsigned lo
} while (addr += PAGE_SIZE, addr != end);
put_dev_pagemap(pgmap);
- return 1;
+ return ret;
}
static int __gup_device_huge_pmd(pmd_t orig, pmd_t *pmdp, unsigned long addr,
_
Patches currently in -mm which might be from akpm@linux-foundation.org are
mm.patch
mm-gup-fix-potential-pgmap-refcnt-leak-in-__gup_device_huge-fix.patch
mm-gup-fix-potential-pgmap-refcnt-leak-in-__gup_device_huge-fix-fix.patch
lazy-tlb-allow-lazy-tlb-mm-refcounting-to-be-configurable-fix.patch
mm-compaction-optimize-proactive-compaction-deferrals-fix.patch
mm-compaction-support-triggering-of-proactive-compaction-by-user-fix.patch
mm-mempolicy-convert-from-atomic_t-to-refcount_t-on-mempolicy-refcnt-fix.patch
mm-damon-implement-primitives-for-the-virtual-memory-address-spaces-fix.patch
mm-damon-implement-a-debugfs-based-user-space-interface-fix.patch
mm-damon-implement-a-debugfs-based-user-space-interface-fix-fix.patch
fs-epoll-use-a-per-cpu-counter-for-users-watches-count-fix-fix.patch
log-if-a-core-dump-is-aborted-due-to-changed-file-permissions-fix.patch
linux-next-rejects.patch
linux-next-git-rejects.patch
kernel-forkc-export-kernel_thread-to-modules.patch
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: + mm-gup-fix-potential-pgmap-refcnt-leak-in-__gup_device_huge-fix-fix.patch added to -mm tree
2021-08-07 18:46 + mm-gup-fix-potential-pgmap-refcnt-leak-in-__gup_device_huge-fix-fix.patch added to -mm tree akpm
@ 2021-08-08 21:12 ` John Hubbard
2021-08-09 1:52 ` Miaohe Lin
1 sibling, 0 replies; 3+ messages in thread
From: John Hubbard @ 2021-08-08 21:12 UTC (permalink / raw)
To: akpm, mm-commits, linmiaohe, kirill.shutemov, jack, imbrenda
On 8/7/21 11:46 AM, akpm@linux-foundation.org wrote:
>
> The patch titled
> Subject: mm-gup-fix-potential-pgmap-refcnt-leak-in-__gup_device_huge-fix-fix
> has been added to the -mm tree. Its filename is
> mm-gup-fix-potential-pgmap-refcnt-leak-in-__gup_device_huge-fix-fix.patch
>
> This patch should soon appear at
> https://ozlabs.org/~akpm/mmots/broken-out/mm-gup-fix-potential-pgmap-refcnt-leak-in-__gup_device_huge-fix-fix.patch
> and later at
> https://ozlabs.org/~akpm/mmotm/broken-out/mm-gup-fix-potential-pgmap-refcnt-leak-in-__gup_device_huge-fix-fix.patch
>
> Before you just go and hit "reply", please:
> a) Consider who else should be cc'ed
> b) Prefer to cc a suitable mailing list as well
> c) Ideally: find the original patch on the mailing list and do a
> reply-to-all to that, adding suitable additional cc's
>
> *** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
>
> The -mm tree is included into linux-next and is updated
> there every 3-4 working days
>
> ------------------------------------------------------
> From: Andrew Morton <akpm@linux-foundation.org>
> Subject: mm-gup-fix-potential-pgmap-refcnt-leak-in-__gup_device_huge-fix-fix
>
> fix return value
OK, the end result now looks correct. For the stacked set of fixes here:
Reviewed-by: John Hubbard <jhubbard@nvidia.com>
thanks,
--
John Hubbard
NVIDIA
>
> Cc: Claudio Imbrenda <imbrenda@linux.ibm.com>
> Cc: Jan Kara <jack@suse.cz>
> Cc: John Hubbard <jhubbard@nvidia.com>
> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Miaohe Lin <linmiaohe@huawei.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
> mm/gup.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> --- a/mm/gup.c~mm-gup-fix-potential-pgmap-refcnt-leak-in-__gup_device_huge-fix-fix
> +++ a/mm/gup.c
> @@ -2240,6 +2240,7 @@ static int __gup_device_huge(unsigned lo
> {
> int nr_start = *nr;
> struct dev_pagemap *pgmap = NULL;
> + int ret = 1;
>
> do {
> struct page *page = pfn_to_page(pfn);
> @@ -2247,12 +2248,14 @@ static int __gup_device_huge(unsigned lo
> pgmap = get_dev_pagemap(pfn, pgmap);
> if (unlikely(!pgmap)) {
> undo_dev_pagemap(nr, nr_start, flags, pages);
> + ret = 0;
> break;
> }
> SetPageReferenced(page);
> pages[*nr] = page;
> if (unlikely(!try_grab_page(page, flags))) {
> undo_dev_pagemap(nr, nr_start, flags, pages);
> + ret = 0;
> break;
> }
> (*nr)++;
> @@ -2260,7 +2263,7 @@ static int __gup_device_huge(unsigned lo
> } while (addr += PAGE_SIZE, addr != end);
>
> put_dev_pagemap(pgmap);
> - return 1;
> + return ret;
> }
>
> static int __gup_device_huge_pmd(pmd_t orig, pmd_t *pmdp, unsigned long addr,
> _
>
> Patches currently in -mm which might be from akpm@linux-foundation.org are
>
> mm.patch
> mm-gup-fix-potential-pgmap-refcnt-leak-in-__gup_device_huge-fix.patch
> mm-gup-fix-potential-pgmap-refcnt-leak-in-__gup_device_huge-fix-fix.patch
> lazy-tlb-allow-lazy-tlb-mm-refcounting-to-be-configurable-fix.patch
> mm-compaction-optimize-proactive-compaction-deferrals-fix.patch
> mm-compaction-support-triggering-of-proactive-compaction-by-user-fix.patch
> mm-mempolicy-convert-from-atomic_t-to-refcount_t-on-mempolicy-refcnt-fix.patch
> mm-damon-implement-primitives-for-the-virtual-memory-address-spaces-fix.patch
> mm-damon-implement-a-debugfs-based-user-space-interface-fix.patch
> mm-damon-implement-a-debugfs-based-user-space-interface-fix-fix.patch
> fs-epoll-use-a-per-cpu-counter-for-users-watches-count-fix-fix.patch
> log-if-a-core-dump-is-aborted-due-to-changed-file-permissions-fix.patch
> linux-next-rejects.patch
> linux-next-git-rejects.patch
> kernel-forkc-export-kernel_thread-to-modules.patch
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: + mm-gup-fix-potential-pgmap-refcnt-leak-in-__gup_device_huge-fix-fix.patch added to -mm tree
2021-08-07 18:46 + mm-gup-fix-potential-pgmap-refcnt-leak-in-__gup_device_huge-fix-fix.patch added to -mm tree akpm
2021-08-08 21:12 ` John Hubbard
@ 2021-08-09 1:52 ` Miaohe Lin
1 sibling, 0 replies; 3+ messages in thread
From: Miaohe Lin @ 2021-08-09 1:52 UTC (permalink / raw)
To: akpm; +Cc: mm-commits, Kirill A. Shutemov, John Hubbard, Jan Kara, imbrenda
On 2021/8/8 2:46, akpm@linux-foundation.org wrote:
>
> The patch titled
> Subject: mm-gup-fix-potential-pgmap-refcnt-leak-in-__gup_device_huge-fix-fix
> has been added to the -mm tree. Its filename is
> mm-gup-fix-potential-pgmap-refcnt-leak-in-__gup_device_huge-fix-fix.patch
>
> This patch should soon appear at
> https://ozlabs.org/~akpm/mmots/broken-out/mm-gup-fix-potential-pgmap-refcnt-leak-in-__gup_device_huge-fix-fix.patch
> and later at
> https://ozlabs.org/~akpm/mmotm/broken-out/mm-gup-fix-potential-pgmap-refcnt-leak-in-__gup_device_huge-fix-fix.patch
>
> Before you just go and hit "reply", please:
> a) Consider who else should be cc'ed
> b) Prefer to cc a suitable mailing list as well
> c) Ideally: find the original patch on the mailing list and do a
> reply-to-all to that, adding suitable additional cc's
>
> *** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
>
> The -mm tree is included into linux-next and is updated
> there every 3-4 working days
>
> ------------------------------------------------------
> From: Andrew Morton <akpm@linux-foundation.org>
> Subject: mm-gup-fix-potential-pgmap-refcnt-leak-in-__gup_device_huge-fix-fix
>
> fix return value
>
> Cc: Claudio Imbrenda <imbrenda@linux.ibm.com>
> Cc: Jan Kara <jack@suse.cz>
> Cc: John Hubbard <jhubbard@nvidia.com>
> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Miaohe Lin <linmiaohe@huawei.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
> mm/gup.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> --- a/mm/gup.c~mm-gup-fix-potential-pgmap-refcnt-leak-in-__gup_device_huge-fix-fix
> +++ a/mm/gup.c
> @@ -2240,6 +2240,7 @@ static int __gup_device_huge(unsigned lo
> {
> int nr_start = *nr;
> struct dev_pagemap *pgmap = NULL;
> + int ret = 1;
>
> do {
> struct page *page = pfn_to_page(pfn);
> @@ -2247,12 +2248,14 @@ static int __gup_device_huge(unsigned lo
> pgmap = get_dev_pagemap(pfn, pgmap);
> if (unlikely(!pgmap)) {
> undo_dev_pagemap(nr, nr_start, flags, pages);
> + ret = 0;
> break;
> }
> SetPageReferenced(page);
> pages[*nr] = page;
> if (unlikely(!try_grab_page(page, flags))) {
> undo_dev_pagemap(nr, nr_start, flags, pages);
> + ret = 0;
> break;
> }
> (*nr)++;
> @@ -2260,7 +2263,7 @@ static int __gup_device_huge(unsigned lo
> } while (addr += PAGE_SIZE, addr != end);
>
> put_dev_pagemap(pgmap);
> - return 1;
> + return ret;
> }
>
Looks good to me. Many thanks for this improvement. :)
> static int __gup_device_huge_pmd(pmd_t orig, pmd_t *pmdp, unsigned long addr,
> _
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-08-09 1:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-07 18:46 + mm-gup-fix-potential-pgmap-refcnt-leak-in-__gup_device_huge-fix-fix.patch added to -mm tree akpm
2021-08-08 21:12 ` John Hubbard
2021-08-09 1:52 ` Miaohe Lin
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).