From patchwork Tue May 24 08:49:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Davydov X-Patchwork-Id: 9133369 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DFA7E607D5 for ; Tue, 24 May 2016 10:24:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D83A428233 for ; Tue, 24 May 2016 10:24:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CD15D28258; Tue, 24 May 2016 10:24:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A29328233 for ; Tue, 24 May 2016 10:24:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753099AbcEXKYP (ORCPT ); Tue, 24 May 2016 06:24:15 -0400 Received: from mail-db3on0123.outbound.protection.outlook.com ([157.55.234.123]:29241 "EHLO emea01-db3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750769AbcEXKYN (ORCPT ); Tue, 24 May 2016 06:24:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=j5eCGpG5eKSgFOQkaEl/6jokMYsBVm+RCX2Pzu6x258=; b=SlPhkRkgnsTTpFxbpnjmR7DyvR97SWgZ0X7suz+vWZej0SX79wmkOSMGx4K0I95ijDU/nhUtBkAS0cIurlwp/A7F85iGen4iLKhzYz67hNJ/fA19fhPYQjm2aMSFglGOvJco9AOHkMHsUxECp7tm4y7BrFuw9I/fDVbQz4GHflM= Authentication-Results: linux-foundation.org; dkim=none (message not signed) header.d=none; linux-foundation.org; dmarc=none action=none header.from=virtuozzo.com; Received: from virtuozzo.com (195.214.232.10) by VI1PR08MB0592.eurprd08.prod.outlook.com (10.163.169.22) with Microsoft SMTP Server (TLS) id 15.1.497.12; Tue, 24 May 2016 08:49:45 +0000 From: Vladimir Davydov To: Andrew Morton CC: "David S. Miller" , Johannes Weiner , Michal Hocko , , , , , Subject: [PATCH RESEND 8/8] af_unix: charge buffers to kmemcg Date: Tue, 24 May 2016 11:49:30 +0300 Message-ID: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [195.214.232.10] X-ClientProxiedBy: VI1PR0901CA0081.eurprd09.prod.outlook.com (10.167.203.177) To VI1PR08MB0592.eurprd08.prod.outlook.com (10.163.169.22) X-MS-Office365-Filtering-Correlation-Id: 4a3dbeba-ad20-4638-f6c3-08d383b05bd6 X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB0592; 2:10o9IlhcrYap+SEq3KvceTNNsx1L/KdeOe7HvpMc6YUPoagwrKJkeZjnCYwPZUEozFx/XZ04/gfuCEJR6kbGoaxv2PGW0gASAwWNSAWB3WKJSffLcCuADLZfRFrWYZmoiZtnn+PDFIqVzy64VJxRPKKU7eGUA1iM8jp0BMJeka9zNRk5QjBwLrUykjkHdMUY; 3:ZyDdHANAi0jVln6R82iYDPTP6XVZSo9ZyKMvve+ewPusVZ7ylbRqR9X94W7IoGQx9+b0nwA47Xm05GXqW6OHfPhpA39ftOviqEwT2BMEQDRFlTFA1oVsU/djTftZ0zFv; 25:Vr4l5/P64el7Cj9XPXn879tP25+YOzD2pN/58yi+AQ6SmVZ9vthKvhtb/yRqgBwIRnhM+8A23f9LQB+OVwMV1uIVO8JnRmaHqjRpNWN//Z04DVmyR7n0kbqWMCS/2fBHwxLBfC09/QLgzYPBcRKumMwLlAVZ1IwLe2l4wreAV+oWTTHvX1OCDUANizI1lfIjYK5D7acinSYC8i68ygdnK+AuTmhYRImE5v63hWiGuNijX8vs8zk4YQqCs3EpdckwPXM6IMT9IqzUMLwr2wXhCBsom2W4x1MvtDiS8u1rlkzZUt1IOeamfebSP81TRgtHdJq0ARNlWWMuC9O4e7a/xRcBiSwMUiJ0anILFxF4sn/OW0wNNL93bdYiMYV8mbr5CXWb/jf1xZlX1PpD/9lHkPq2ejC6cMEgi+tNPmSFua4= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:VI1PR08MB0592; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040130)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041072)(6043046); SRVR:VI1PR08MB0592; BCL:0; PCL:0; RULEID:; SRVR:VI1PR08MB0592; X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB0592; 4:57Qeg65wMbS836joe0/pZvaJrLX/MAZgzSmzwurzH+pFY1y6vew9b80MYZn7dMnGpudOSP2bdTiiG6QETRxxU8rvwbFV13ELrxMBmYjwgB/Rbd5tlIPn6fK2VsALCydLasLwMUSmkTYS/Zdy/9Zc0xEy8KcmrUaq4gdG+O+qUka3WEAU1kcVUACXctPRjEvOSa1bFUvh6zflguCG0fe6NvEV0+B7EU0o9aYLdoijfJzheS+KGvBh0QdlExbUOk6DNQkpXPlMgwgvccYqdkgd8FLA/X+972ErtFFxV+PyP463Px2QfNtTQWxoL4A/oQHs4vIuwvbYl2XRsrheSzHS3xrn/28npUstIlDSasTSCCQLqIg0K8L+l4g2G0smOFUcpM58nv+wuDp+xK/t+ArYK+ioccYDQMTdQeEjhYpnO7k= X-Forefront-PRVS: 09525C61DB X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(586003)(36756003)(3846002)(6116002)(2950100001)(77096005)(76176999)(50986999)(86362001)(110136002)(92566002)(19580405001)(118296001)(19580395003)(5008740100001)(189998001)(229853001)(2906002)(4326007)(47776003)(5004730100002)(66066001)(50466002)(8676002)(80792005)(5003940100001)(33646002)(81166006)(42186005)(48376002)(50226002)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR08MB0592; H:virtuozzo.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB0592; 23:yPBuB8YT8T/MXEAth4ErPP7Gleo+73LPCNIZZQErMdL1z+wNsGP23evuIXA2nyGnyzxeKW9qkr57yBTxdgGGQqvS9/h92LebCiTM9BhaMFuuFUbrqnurivD7gXkkkw4TVYCdxhtDTeY0N3zpOXh5hFhitO7+fhkf5i0zapixES70y22jTI2RrDnwqkn2AA1Uv3CvybIMoUq/HaUBLutaiDKmwOuRZpzS9EBe6dBOMouVy/h6PIQdoWGvN+8jgKarlm7nOJU9Pniwj4OyH1IzLza9yyr6iCFTzQeGtkhBgyHL5kkDHZ9nxfOApTQSS8RrmF3nEd5P5rJdSYnr7ZfolQS+maFo/VUuCY4aEdoxnWQm3PMqf3Zzh3Xly+9DDi+XXnoQHL+FbKSmEJ7R5sYBvEURlLBv4zPVwY2/5ENSV8cpUv9jDU3YNYhvHcmZIcbBB1huGKNNvVWqBGKnaNqwhZJaX7yhowCUHbGssHzVgI/iyKzrEyJUG6eqQzP3IL5Fc5MYBE250MzPa7q7sQILIp8rV9mzP3WJqfLwIfOHlvOgBHF8YwiysiZNOvI/XRfCQXKVZyrj8e7gqsnfh16Mm8eDftpkXdUy0O5nB06M95FT9sI6wANcU0cCo+Z2RewX1E65tVnLA6PPJzq3sRKdu5/EU3epwYR6dwaT6oqE2t/S5mV0FUOlxSzE0MEJ+AD+NxX32Tsxge+nGBch8kq/DGPu2LEekBeDTw6N8AI0Rz48zjhsI50iuUe3ZtSRoVLWh2Gnmq1kgNjnT329TCgnt2lviwdN2NgYkcGXGmzQq+5UhdgRx3PmZ9SW0j1ay3ZDhQEJ8vdFpUH+Qqpo/JuSvbcWQ0puJrL+h7bb0goaSbqxhfV+qjqbI1/DiqKJdG4J7M+Qd2FYbMIF8N97Bbkm4GtYK9pANmNNf0MvxhYHw Fs= X-Microsoft-Exchange-Diagnostics: 1; VI1PR08MB0592; 5:p3Sj9vf1Qca9N9ukmCgf5AMJaAyaho/F7Um8MKMQdlPu3J8g1QZfs9Ej4Ab5ov+akt0c/agpkiH9gHnSE5f4cNWjYJNb+iYbndhJeCzNwmfR+Xyvt2PN/TzGonLU1ESKAV0ZGPfNckrLfEKWOt5e2w==; 24:B8kFh6RZNa6lpc3KvAFQnbsJS7nvofQdvbfI693vYZvC8vMTpkhXB6lHCCePSgvytw61xiuFr8saHeKY6tsY41ib7XfQlTW/CtYzq2qCv8s=; 7:j8ODA4P20SpEgWG2JGni0lP+oUe/cdPjd/TUzHqidGFCEjEtjJ0rAWVtHAQpfGeyPswShyK6S6U6lZE7P9El8JdCnUX4v6VGk2q1kjkQO3GW7eXcc7+J8mpeOA1BcCMGd6Ip391YIxGbrYIO76hIwcgaTw/u2CDebU9tDlxUmD/oYFixUnFUq+SwT2lOKYsS; 20:XxsUReL5IwHzOobT2nyKOHdq0ucxcI4v7e5avNU7/uvBmYYhFPUN3g9BwBbIyfvPMfQZqAbgpcLFnX60IO7FvA6RVbVwB7DNkdIwYogCCoFM9dx3Yhx1LaBbUDQh1FeCi6PwEnF4LxY+XF63+0G4XDr3mUwplmji9+x89uCo8zQ= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2016 08:49:45.9231 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB0592 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Unix sockets can consume a significant amount of system memory, hence they should be accounted to kmemcg. Since unix socket buffers are always allocated from process context, all we need to do to charge them to kmemcg is set __GFP_ACCOUNT in sock->sk_allocation mask. Signed-off-by: Vladimir Davydov Cc: "David S. Miller" --- net/unix/af_unix.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 80aa6a3e6817..022bdd3ab7d9 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -769,6 +769,7 @@ static struct sock *unix_create1(struct net *net, struct socket *sock, int kern) lockdep_set_class(&sk->sk_receive_queue.lock, &af_unix_sk_receive_queue_lock_key); + sk->sk_allocation = GFP_KERNEL_ACCOUNT; sk->sk_write_space = unix_write_space; sk->sk_max_ack_backlog = net->unx.sysctl_max_dgram_qlen; sk->sk_destruct = unix_sock_destructor;