LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v1 1/1] mm/ksm: fix inconsistent accounting of zero pages
@ 2018-04-05 12:27 Claudio Imbrenda
2018-04-05 13:50 ` Greg KH
2018-04-09 3:37 ` Sasha Levin
0 siblings, 2 replies; 3+ messages in thread
From: Claudio Imbrenda @ 2018-04-05 12:27 UTC (permalink / raw)
To: linux-kernel
Cc: akpm, aarcange, minchan, kirill.shutemov, linux-mm, hughd,
borntraeger, gerald.schaefer, stable
When using KSM with use_zero_pages, we replace anonymous pages
containing only zeroes with actual zero pages, which are not anonymous.
We need to do proper accounting of the mm counters, otherwise we will
get wrong values in /proc and a BUG message in dmesg when tearing down
the mm.
Fixes: e86c59b1b1 ("mm/ksm: improve deduplication of zero pages with colouring")
Signed-off-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
---
mm/ksm.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/mm/ksm.c b/mm/ksm.c
index 293721f..2d6b352 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -1131,6 +1131,13 @@ static int replace_page(struct vm_area_struct *vma, struct page *page,
} else {
newpte = pte_mkspecial(pfn_pte(page_to_pfn(kpage),
vma->vm_page_prot));
+ /*
+ * We're replacing an anonymous page with a zero page, which is
+ * not anonymous. We need to do proper accounting otherwise we
+ * will get wrong values in /proc, and a BUG message in dmesg
+ * when tearing down the mm.
+ */
+ dec_mm_counter(mm, MM_ANONPAGES);
}
flush_cache_page(vma, addr, pte_pfn(*ptep));
--
2.7.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1 1/1] mm/ksm: fix inconsistent accounting of zero pages
2018-04-05 12:27 [PATCH v1 1/1] mm/ksm: fix inconsistent accounting of zero pages Claudio Imbrenda
@ 2018-04-05 13:50 ` Greg KH
2018-04-09 3:37 ` Sasha Levin
1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2018-04-05 13:50 UTC (permalink / raw)
To: Claudio Imbrenda
Cc: linux-kernel, akpm, aarcange, minchan, kirill.shutemov, linux-mm,
hughd, borntraeger, gerald.schaefer, stable
On Thu, Apr 05, 2018 at 02:27:54PM +0200, Claudio Imbrenda wrote:
> When using KSM with use_zero_pages, we replace anonymous pages
> containing only zeroes with actual zero pages, which are not anonymous.
> We need to do proper accounting of the mm counters, otherwise we will
> get wrong values in /proc and a BUG message in dmesg when tearing down
> the mm.
>
> Fixes: e86c59b1b1 ("mm/ksm: improve deduplication of zero pages with colouring")
>
> Signed-off-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
> ---
> mm/ksm.c | 7 +++++++
> 1 file changed, 7 insertions(+)
<formletter>
This is not the correct way to submit patches for inclusion in the
stable kernel tree. Please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.
</formletter>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1 1/1] mm/ksm: fix inconsistent accounting of zero pages
2018-04-05 12:27 [PATCH v1 1/1] mm/ksm: fix inconsistent accounting of zero pages Claudio Imbrenda
2018-04-05 13:50 ` Greg KH
@ 2018-04-09 3:37 ` Sasha Levin
1 sibling, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2018-04-09 3:37 UTC (permalink / raw)
To: Sasha Levin, Claudio Imbrenda, linux-kernel
Cc: akpm, aarcange, minchan, stable
Hi,
[This is an automated email]
This commit has been processed because it contains a "Fixes:" tag,
fixing commit: e86c59b1b12d mm/ksm: improve deduplication of zero pages with colouring.
The bot has also determined it's probably a bug fixing patch. (score: 20.2626)
The bot has tested the following trees: v4.16, v4.15.15, v4.14.32.
v4.16: Build OK!
v4.15.15: Build OK!
v4.14.32: Build OK!
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-04-09 3:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-05 12:27 [PATCH v1 1/1] mm/ksm: fix inconsistent accounting of zero pages Claudio Imbrenda
2018-04-05 13:50 ` Greg KH
2018-04-09 3:37 ` Sasha Levin
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).