[Devel,RHEL7,COMMIT] netfilter/x_tables: account entry offsets allocations

Submitted by Konstantin Khorenko on Feb. 2, 2017, 4:56 p.m.

Details

Message ID 201702021656.v12GuqkS019471@finist_cl7.x64_64.work.ct
State New
Series "netfilter/x_tables: account entry offsets allocations"
Headers show

Commit Message

Konstantin Khorenko Feb. 2, 2017, 4:56 p.m.
The commit is pushed to "branch-rh7-3.10.0-514.6.1.vz7.28.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.6.1.vz7.28.3
------>
commit bcc185b61d0922de58f4f50f4e6717a43d558c97
Author: Andrey Ryabinin <aryabinin@virtuozzo.com>
Date:   Thu Feb 2 20:56:52 2017 +0400

    netfilter/x_tables: account entry offsets allocations
    
    Entry offsets may consume a lot of kernel memory. So let's account
    them.
    
    https://jira.sw.ru/browse/PSBM-54407
    
    Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
 net/netfilter/x_tables.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index 4e2eb14..8174d0c 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -799,13 +799,14 @@  unsigned int *xt_alloc_entry_offsets(unsigned int size)
 {
 	unsigned int *off;
 
-	off = kcalloc(size, sizeof(unsigned int), GFP_KERNEL | __GFP_NOWARN);
+	off = kcalloc(size, sizeof(unsigned int),
+		GFP_KERNEL_ACCOUNT | __GFP_NOWARN);
 
 	if (off)
 		return off;
 
 	if (size < (SIZE_MAX / sizeof(unsigned int)))
-		off = vmalloc(size * sizeof(unsigned int));
+		off = vmalloc_account(size * sizeof(unsigned int));
 
 	return off;
 }