From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shakeel Butt Subject: Re: Low TCP throughput due to vmpressure with swap enabled Date: Thu, 8 Dec 2022 00:31:36 +0000 Message-ID: <20221208003136.fxm6msgiswl2xdac@google.com> References: <20221206231049.g35ltbxbk54izrie@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=phKzW+pnWcxpZMlO+OGC3q3KyWa3Ai371n7pkUjY42s=; b=GcvzBKZHxUPcMbsMIVs11wJmblKLng4iReNp1M5ibs/jGlVOlzs8gse33hKi0r80d3 4py+w8LI+3nJYWK8ZHaSqhXB2Uiak2y9NhC7j3lJ6R1R69as73jNKJKxJH9LiwjI8e1d MetDnMkMhXBRBjs9blHiXf9td0dJKWvI6zm9E3odBEh/Q0aEDhi9QSdUDkbSJu0sBLf7 GmD67NVPCz8BOXn9qmTnJmvuIfl7OIhCFLqkKxmDFJOjrSau5U5GhJqzKYp7SqdjHIFp NH630+6SYXOZNb0eEnqgRPAuNnT0GH0bcEZ+5l/9XRUIU/cBltRovIN/r4VTIfO5+EP9 y2Cg== In-Reply-To: List-ID: Content-Transfer-Encoding: 7bit To: Johannes Weiner Cc: Eric Dumazet , Ivan Babrou , Linux MM , Linux Kernel Network Developers , linux-kernel , Michal Hocko , Roman Gushchin , Muchun Song , Andrew Morton , "David S. Miller" , Hideaki YOSHIFUJI , David Ahern , Jakub Kicinski , Paolo Abeni , cgroups@vger.kernel.org, kernel-team On Wed, Dec 07, 2022 at 01:53:00PM +0100, Johannes Weiner wrote: [...] > > I don't mind doing that if necessary, but looking at the code I don't > see why it would be. > > The socket code sets protocol memory pressure on allocations that run > into limits, and clears pressure on allocations that succeed and > frees. Why shouldn't we do the same thing for memcg? > I think you are right. Let's go with whatever you have for now as this will reduce vmpressure dependency. However I think there are still open issues that needs to be addressed in the future: 1. Unlike TCP memory accounting, memcg has to account/charge user memory, kernel memory and tcp/netmem. So, it might make more sense to enter the pressure state in try_charge_memcg() function. This means charging of user memory or kernel memory can also put the memcg under socket pressure. 2. On RX path, the memcg charge can succeed due to GFP_ATOMIC flag. Should we reset the pressure state in that case? 3. On uncharge path, unlike network stack, should we unconditionally reset the socket pressure state? Shakeel