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

Konstantin Khorenko khorenko at virtuozzo.com
Thu Feb 2 08:56:52 PST 2017


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 at 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 at virtuozzo.com>
---
 net/netfilter/x_tables.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

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;
 }


More information about the Devel mailing list