Commit 9793c26
dm crypt: account large pages in cc->n_allocated_pages
The commit 5054e77 ("dm crypt: allocate compound pages if
possible") changed dm-crypt to use compound pages to improve
performance. Unfortunately, there was an oversight: the allocation of
compound pages was not accounted at all. Normal pages are accounted in
a percpu counter cc->n_allocated_pages and dm-crypt is limited to
allocate at most 2% of memory. Because compound pages were not
accounted at all, dm-crypt could allocate memory over the 2% limit.
Fix this by adding the accounting of compound pages, so that memory
consumption of dm-crypt is properly limited.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Fixes: 5054e77 ("dm crypt: allocate compound pages if possible")
Cc: stable@vger.kernel.org # v6.5+
Signed-off-by: Mike Snitzer <snitzer@kernel.org>1 parent 070bb43 commit 9793c26
1 file changed
Lines changed: 12 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1692 | 1692 | | |
1693 | 1693 | | |
1694 | 1694 | | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + | |
1695 | 1698 | | |
1696 | 1699 | | |
1697 | 1700 | | |
1698 | | - | |
| 1701 | + | |
| 1702 | + | |
1699 | 1703 | | |
| 1704 | + | |
| 1705 | + | |
1700 | 1706 | | |
1701 | 1707 | | |
1702 | 1708 | | |
| |||
1734 | 1740 | | |
1735 | 1741 | | |
1736 | 1742 | | |
1737 | | - | |
| 1743 | + | |
| 1744 | + | |
| 1745 | + | |
1738 | 1746 | | |
1739 | | - | |
| 1747 | + | |
1740 | 1748 | | |
| 1749 | + | |
1741 | 1750 | | |
1742 | 1751 | | |
1743 | 1752 | | |
| |||
0 commit comments