From patchwork Tue Jul 11 12:41:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Wu X-Patchwork-Id: 13308647 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C64E9C0015E for ; Tue, 11 Jul 2023 12:42:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3CCCE6B0071; Tue, 11 Jul 2023 08:42:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 37BAB6B0074; Tue, 11 Jul 2023 08:42:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 21C6B6B0075; Tue, 11 Jul 2023 08:42:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 0DFC66B0071 for ; Tue, 11 Jul 2023 08:42:26 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 5F2B4140215 for ; Tue, 11 Jul 2023 12:42:25 +0000 (UTC) X-FDA: 80999294250.16.7A0FCC6 Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) by imf02.hostedemail.com (Postfix) with ESMTP id 9642480006 for ; Tue, 11 Jul 2023 12:42:22 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=MQ5ty+Ms; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf02.hostedemail.com: domain of wuyun.abel@bytedance.com designates 209.85.210.172 as permitted sender) smtp.mailfrom=wuyun.abel@bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689079343; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=dmg9w9P3JYlTE5YF/tdSGmQe9gMk9DKIlFnuajmtraM=; b=SkDkSp6x/NrwSzZIEeO5YCdWS8XJL+G/SKv9G0dOoGA/19/nJSvjhUjH80bOnlpaUcoLCL eHuFMAZAHZKPXjUaDibaKZiM4LalHwUoSAjgXEF/eJXdPvbU0scsdMW4EsPGxwotwE5tvw PMdIlwKBsQ/IXsDtZUVD8E5nrn/93hs= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=MQ5ty+Ms; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf02.hostedemail.com: domain of wuyun.abel@bytedance.com designates 209.85.210.172 as permitted sender) smtp.mailfrom=wuyun.abel@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689079343; a=rsa-sha256; cv=none; b=YqMKmoiFLl6E5+3BU7cp9TBH7+NplMYrJVjBNW+PELgz1ySlPUBN7PJqAhSsKVFACb8lHI /A1TPKcXboutVnxXWU6eSGf+FwlhpbvAk0eQaSa0OLPLi4BQjxtLcz6bZ2uGaudHCK2owt EZc5hoLdQ0jOr1Z8B2AG6shm9kuFCf4= Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-66767d628e2so3725813b3a.2 for ; Tue, 11 Jul 2023 05:42:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1689079341; x=1691671341; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=dmg9w9P3JYlTE5YF/tdSGmQe9gMk9DKIlFnuajmtraM=; b=MQ5ty+Ms9xq2Gf8tT1u5KINp7LbCz3vSzcp6PPkar1PjXy2UOGDAONbcJWbI+E3Z1E ikZ8U8ait2Sr5BYSdZ0mnqv3UujdxGaHwIDateSlAtRLzEgup9mGA8YcL/qo1k0FBGy/ FtozdxhzC6z10cVS8YU1HM4+O48pgEHDp5kJRIJNhHnzy5o1QbbQV3vpzByt9eoJCZRF j8KrPcF99ChxD4ntqNGXPWk8MUCnNrtMqO4RYfasM8ZE8cbOScyeoYS5plADx8+31TVK GOG7vI2PVHSpTcdBFa0p7rhtBHE39/Z0gT8Ap6MdmyXF7tQb0/Zbshyqv+rLDj6qHTCL oBZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689079341; x=1691671341; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dmg9w9P3JYlTE5YF/tdSGmQe9gMk9DKIlFnuajmtraM=; b=R2sQlONteFHm7ZQ/QAewX0PzH9Eq4irgV/tbNiZCshXDIGyAd0visipsTPqBMXCcGQ thXaylsmvXX/yFIdojiObel4CIDcSZ/ibdYdG1ymxash0r4Or4yjKLvFJDBG3XrsmSPr GccZZgKDZ2vvhoU4L6G0nXS4sMd1AZEbPj4ZoLxNea9OQor83YzVgoGD8enTT28yH0QN 7TORV930FFZEqHqMqwmRyikUGwyWPQljJDYB+t7hUvT6hCWWp3fP9SSMVGWVvEvB8k0b 7yYl2Vcqy+W4smBzdShzb47hijXwdppgjC3nqbZK0l4eCFTCT0RHmlCUVDz5DsATWy7S 6f6g== X-Gm-Message-State: ABy/qLaQyNBVzvu+kk9nlm2KWTVLvMn1csD5JmZwrVzoRPypMRSBS5pf iXTvY4UGDo7J8OMkwqEUOggFlQ== X-Google-Smtp-Source: APBJJlHySXBwiacKDORZhjNJUBjRrtdwMto4+SpJ1LfQJNYde55u+zkHIULuNxcqHK6dl79az4tI4A== X-Received: by 2002:a05:6a20:3948:b0:127:8833:cce3 with SMTP id r8-20020a056a20394800b001278833cce3mr15034530pzg.8.1689079341001; Tue, 11 Jul 2023 05:42:21 -0700 (PDT) Received: from C02DV8HUMD6R.bytedance.net ([203.208.167.147]) by smtp.gmail.com with ESMTPSA id d27-20020a63735b000000b0055c0508780asm1512222pgn.73.2023.07.11.05.42.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jul 2023 05:42:20 -0700 (PDT) From: Abel Wu To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , David Ahern , Yosry Ahmed , "Matthew Wilcox (Oracle)" , Yu Zhao , Kefeng Wang , Yafang Shao , Kuniyuki Iwashima , Martin KaFai Lau , Alexander Mikhalitsyn , Breno Leitao , David Howells , Jason Xing , Xin Long Cc: Abel Wu , Michal Hocko , Alexei Starovoitov , linux-kernel@vger.kernel.org (open list), netdev@vger.kernel.org (open list:NETWORKING [GENERAL]), cgroups@vger.kernel.org (open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG)), linux-mm@kvack.org (open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG)) Subject: [PATCH RESEND net-next 1/2] net-memcg: Scopify the indicators of sockmem pressure Date: Tue, 11 Jul 2023 20:41:43 +0800 Message-Id: <20230711124157.97169-1-wuyun.abel@bytedance.com> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 X-Rspamd-Queue-Id: 9642480006 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: h9t5e9ghcrioybq67pfx1pgi784zc9zs X-HE-Tag: 1689079342-182318 X-HE-Meta: U2FsdGVkX1+36AD67EmgvbdvzSVTywGreWfZYGwPcbAEhwjCZGNnayBvzWmDpV/7BtwuyaJgOfMLSHUYbv0loL1EOSp2CsctxsUZcz0uvLc9wDgPYKI5W25wiaqW0u2QWklWSqi0GEZQGfMT7Yg7LMkI3uIGXLlmB0N2HxVdKCBS4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Mu0XwsBKX7LaL7Iq7izdcXM5mgvdljz/zRa50= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Now there are two indicators of socket memory pressure sit inside struct mem_cgroup, socket_pressure and tcpmem_pressure. When in legacy mode aka. cgroupv1, the socket memory is charged into a separate counter memcg->tcpmem rather than ->memory, so the reclaim pressure of the memcg has nothing to do with socket's pressure at all. While for default mode, the ->tcpmem is simply not used. So {socket,tcpmem}_pressure are only used in default/legacy mode respectively. This patch fixes the pieces of code that make mixed use of both. Signed-off-by: Abel Wu --- include/linux/memcontrol.h | 4 ++-- mm/vmpressure.c | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 5818af8eca5a..5860c7f316b9 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -1727,8 +1727,8 @@ void mem_cgroup_sk_alloc(struct sock *sk); void mem_cgroup_sk_free(struct sock *sk); static inline bool mem_cgroup_under_socket_pressure(struct mem_cgroup *memcg) { - if (!cgroup_subsys_on_dfl(memory_cgrp_subsys) && memcg->tcpmem_pressure) - return true; + if (!cgroup_subsys_on_dfl(memory_cgrp_subsys)) + return !!memcg->tcpmem_pressure; do { if (time_before(jiffies, READ_ONCE(memcg->socket_pressure))) return true; diff --git a/mm/vmpressure.c b/mm/vmpressure.c index b52644771cc4..22c6689d9302 100644 --- a/mm/vmpressure.c +++ b/mm/vmpressure.c @@ -244,6 +244,14 @@ void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, bool tree, if (mem_cgroup_disabled()) return; + /* + * The in-kernel users only care about the reclaim efficiency + * for this @memcg rather than the whole subtree, and there + * isn't and won't be any in-kernel user in a legacy cgroup. + */ + if (!cgroup_subsys_on_dfl(memory_cgrp_subsys) && !tree) + return; + vmpr = memcg_to_vmpressure(memcg); /* From patchwork Tue Jul 11 12:41:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Wu X-Patchwork-Id: 13308648 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D78EAC0015E for ; Tue, 11 Jul 2023 12:42:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3CBD86B0074; Tue, 11 Jul 2023 08:42:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 356EB6B0075; Tue, 11 Jul 2023 08:42:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 21CC56B0078; Tue, 11 Jul 2023 08:42:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 12E4C6B0074 for ; Tue, 11 Jul 2023 08:42:42 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id D2DC61A01C5 for ; Tue, 11 Jul 2023 12:42:41 +0000 (UTC) X-FDA: 80999294922.23.2F89A9D Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by imf11.hostedemail.com (Postfix) with ESMTP id 034D84000A for ; Tue, 11 Jul 2023 12:42:39 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=PfObz486; spf=pass (imf11.hostedemail.com: domain of wuyun.abel@bytedance.com designates 209.85.210.180 as permitted sender) smtp.mailfrom=wuyun.abel@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689079360; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=WF8p9HwwgSPuKR34SMZuqSQ7aAssq/odh5sAxqcKAUo=; b=siW4yNDZefbCi9qxJyI2sKHuTo+MHDj+3U0l+Iihs2IsU3bOz1H2QKbfKBGaoGaqY8Vh0x dcL5+fx1NVY3nn2Tas+R+Q+9RBXyDu33fQ76Yh4iAKQIqLylFX6PqPptpNH0OOL739DN3u +hTMmPB/QIhFNUENmSY/CdTH7dXC8Wk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689079360; a=rsa-sha256; cv=none; b=S6eUq8EK7/FXwn+4yWYNaXdaWBxA6Ho4qFnfjJ+3zMGOF0QFtoLRYdddZxKT6JAjSafN7N 4QJ8wEF1uK+pvr25ThOAgWetuO1Pbu01+wDMw5yHLc45fODlxY+993xMAlwml0UDO6F5xR /v3eAosKp2VSdHljwW8xwdVHIzvP334= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=PfObz486; spf=pass (imf11.hostedemail.com: domain of wuyun.abel@bytedance.com designates 209.85.210.180 as permitted sender) smtp.mailfrom=wuyun.abel@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-666683eb028so3038990b3a.0 for ; Tue, 11 Jul 2023 05:42:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1689079359; x=1691671359; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WF8p9HwwgSPuKR34SMZuqSQ7aAssq/odh5sAxqcKAUo=; b=PfObz486Wz+B8XCRMJmNpdOHd0bdAenCGoIFIrS0nn6pqgOGHIHHLLi/E7y4xelPQs oV1L5cDtGQ4gFHo4+itEHIwzUsNI9UXysv8UU/Pza3CLcUbZHUcxkt1As11YdvxnX8RF H17ZVvTu4nrEDSvdfN39NUxyIGNfeoTwnjdkSADFNYnqT8BI11t6wbWjHwH7o/9kadrH e5S5yw3IMsz3lksjyY+6iOF1Q4m7p0LVb07p4UTqbAdR2d9VI1K3CWAVsuHGT4SgzzBo xLZVs2ZfUmoYmSJPyCtnkjpSavzGDmGYFi8eCIFGc6qahboTah/quQSujY0SX5PCPa3e hfRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689079359; x=1691671359; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WF8p9HwwgSPuKR34SMZuqSQ7aAssq/odh5sAxqcKAUo=; b=lLHBxcRGFWCXt/SvNJGFNhq7yWyVt/BJMoNGZ/DXXWEgsF386qlDo9gCdd7VtW2LxP qQHqkTrq2vwWB5VBDsKCIu5Qr+P2y0qUvMNi+8tIjAwffvfK56cVuhwoKdEr8CNw4g9C w4/7FMFGMAwg237e7TsKlDSP6QhElAVNtA4xNLOGKZqVrrvK1NSUr1iAABkdukyTeF0c nry6bQt6XN93eYihynK21yCh9quAVdHhzxDW7Bia9VJjZu3heffgZWQKIFAB+HIrTgeI Mvt8LfU9imo9qkY8m/yEakBSQnyNOQ6YiUcosRS/u94Km6FBrOOCVpGHgkrzXiGarUcZ W+MA== X-Gm-Message-State: ABy/qLa44fjBktTn8V8TqIS69zr4OJdVfLKmOi3rrxC2ygG+b3O8S2Gy 2Zl5A9/fQdbv58ERQ0/86V2puQ== X-Google-Smtp-Source: APBJJlF8Ng7++YijKQqg29ZCVWXJRwBhX6TmRTz/uJVTeJyWO9yu17EmSQrDts1Z+LLhsS5GxNFl2g== X-Received: by 2002:a05:6a20:1456:b0:12d:d17d:c811 with SMTP id a22-20020a056a20145600b0012dd17dc811mr13827670pzi.21.1689079358984; Tue, 11 Jul 2023 05:42:38 -0700 (PDT) Received: from C02DV8HUMD6R.bytedance.net ([203.208.167.147]) by smtp.gmail.com with ESMTPSA id d27-20020a63735b000000b0055c0508780asm1512222pgn.73.2023.07.11.05.42.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jul 2023 05:42:38 -0700 (PDT) From: Abel Wu To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , David Ahern , Yosry Ahmed , "Matthew Wilcox (Oracle)" , Yu Zhao , Abel Wu , Yafang Shao , Kefeng Wang , Kuniyuki Iwashima , Martin KaFai Lau , Alexander Mikhalitsyn , Breno Leitao , David Howells , Jason Xing , Xin Long Cc: Michal Hocko , linux-kernel@vger.kernel.org (open list), netdev@vger.kernel.org (open list:NETWORKING [GENERAL]), cgroups@vger.kernel.org (open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG)), linux-mm@kvack.org (open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG)) Subject: [PATCH RESEND net-next 2/2] net-memcg: Remove redundant tcpmem_pressure Date: Tue, 11 Jul 2023 20:41:44 +0800 Message-Id: <20230711124157.97169-2-wuyun.abel@bytedance.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20230711124157.97169-1-wuyun.abel@bytedance.com> References: <20230711124157.97169-1-wuyun.abel@bytedance.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 034D84000A X-Rspam-User: X-Stat-Signature: r44zjdp9fcsdpp36b1gufnatiau1okg1 X-Rspamd-Server: rspam03 X-HE-Tag: 1689079359-330237 X-HE-Meta: U2FsdGVkX1/OMkpdupFFtFfkUOlTEyqComXCXvshbDLQwPeA6x5C+3PJGAFDkOjHbhkJG/dPKeC0472/Uw7z9RRSzftn0b41iPqwTKZ4Ajya3N5kyn1L5tP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1NOD9iOIjqKL5dvz0ib/3ccAfMIaAIW9FzGDs92+9r2+mUz+WNEgkducRFyjQ1nNnpIDrSiRqrjWMHgrR+aab1yNajb1Te4N1gOG978hpKQ/rWKlMjnhzc0rvt2jdmfg= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: As {socket,tcpmem}_pressure are only used in default/legacy mode respectively, use socket_pressure instead of tcpmem_pressure in all kinds of cgroup hierarchies. Signed-off-by: Abel Wu --- include/linux/memcontrol.h | 3 +-- mm/memcontrol.c | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 5860c7f316b9..341d397186ff 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -288,7 +288,6 @@ struct mem_cgroup { /* Legacy tcp memory accounting */ bool tcpmem_active; - int tcpmem_pressure; #ifdef CONFIG_MEMCG_KMEM int kmemcg_id; @@ -1728,7 +1727,7 @@ void mem_cgroup_sk_free(struct sock *sk); static inline bool mem_cgroup_under_socket_pressure(struct mem_cgroup *memcg) { if (!cgroup_subsys_on_dfl(memory_cgrp_subsys)) - return !!memcg->tcpmem_pressure; + return !!memcg->socket_pressure; do { if (time_before(jiffies, READ_ONCE(memcg->socket_pressure))) return true; diff --git a/mm/memcontrol.c b/mm/memcontrol.c index e8ca4bdcb03c..e9e26dbd65b5 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -7292,10 +7292,10 @@ bool mem_cgroup_charge_skmem(struct mem_cgroup *memcg, unsigned int nr_pages, struct page_counter *fail; if (page_counter_try_charge(&memcg->tcpmem, nr_pages, &fail)) { - memcg->tcpmem_pressure = 0; + memcg->socket_pressure = 0; return true; } - memcg->tcpmem_pressure = 1; + memcg->socket_pressure = 1; if (gfp_mask & __GFP_NOFAIL) { page_counter_charge(&memcg->tcpmem, nr_pages); return true;