Commit c3cc391
mm: memcontrol: fix NR_WRITEBACK leak in memcg and system stats
After commit a983b5e ("mm: memcontrol: fix excessive complexity in
memory.stat reporting"), we observed slowly upward creeping NR_WRITEBACK
counts over the course of several days, both the per-memcg stats as well
as the system counter in e.g. /proc/meminfo.
The conversion from full per-cpu stat counts to per-cpu cached atomic
stat counts introduced an irq-unsafe RMW operation into the updates.
Most stat updates come from process context, but one notable exception
is the NR_WRITEBACK counter. While writebacks are issued from process
context, they are retired from (soft)irq context.
When writeback completions interrupt the RMW counter updates of new
writebacks being issued, the decs from the completions are lost.
Since the global updates are routed through the joint lruvec API, both
the memcg counters as well as the system counters are affected.
This patch makes the joint stat and event API irq safe.
Link: http://lkml.kernel.org/r/[email protected]
Fixes: a983b5e ("mm: memcontrol: fix excessive complexity in memory.stat reporting")
Signed-off-by: Johannes Weiner <[email protected]>
Debugged-by: Tejun Heo <[email protected]>
Reviewed-by: Rik van Riel <[email protected]>
Reviewed-by: Andrew Morton <[email protected]>
Cc: Vladimir Davydov <[email protected]>
Cc: Michal Hocko <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>1 parent 101110f commit c3cc391
1 file changed
+16
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
523 | 523 | | |
524 | 524 | | |
525 | 525 | | |
526 | | - | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
527 | 529 | | |
528 | | - | |
| 530 | + | |
529 | 531 | | |
530 | 532 | | |
531 | 533 | | |
| |||
606 | 608 | | |
607 | 609 | | |
608 | 610 | | |
609 | | - | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
610 | 614 | | |
611 | | - | |
| 615 | + | |
612 | 616 | | |
613 | 617 | | |
614 | 618 | | |
| |||
630 | 634 | | |
631 | 635 | | |
632 | 636 | | |
633 | | - | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
634 | 640 | | |
635 | | - | |
| 641 | + | |
636 | 642 | | |
637 | 643 | | |
638 | 644 | | |
| |||
659 | 665 | | |
660 | 666 | | |
661 | 667 | | |
662 | | - | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
663 | 671 | | |
664 | | - | |
| 672 | + | |
665 | 673 | | |
666 | 674 | | |
667 | 675 | | |
| |||
0 commit comments