From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA24BC35242 for ; Sat, 15 Feb 2020 00:11:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 904A92073A for ; Sat, 15 Feb 2020 00:11:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="mQXv020x" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 904A92073A Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2689F6B0003; Fri, 14 Feb 2020 19:11:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 218C16B0005; Fri, 14 Feb 2020 19:11:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 12E9C6B0006; Fri, 14 Feb 2020 19:11:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0135.hostedemail.com [216.40.44.135]) by kanga.kvack.org (Postfix) with ESMTP id F00546B0003 for ; Fri, 14 Feb 2020 19:11:37 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 897A6181AEF0B for ; Sat, 15 Feb 2020 00:11:37 +0000 (UTC) X-FDA: 76490432634.09.eyes24_48577977ff813 X-HE-Tag: eyes24_48577977ff813 X-Filterd-Recvd-Size: 4508 Received: from mail-yb1-f195.google.com (mail-yb1-f195.google.com [209.85.219.195]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Sat, 15 Feb 2020 00:11:36 +0000 (UTC) Received: by mail-yb1-f195.google.com with SMTP id z125so5655309ybf.9 for ; Fri, 14 Feb 2020 16:11:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Qj2zBbkIxBGfCERuHV86VP5E7OnuA4mxy13S+8Juj1A=; b=mQXv020xrGiFQVRcG+t3iVDyjz5L4TGdw0U6fbXeCwxrDC4hDSpg0HBUuUifRpC35r IAr+R+LZdTurVkQIlblgBmObc9b8hX5L2QMJXSgw+ykNNQcG5LVdhpwoKmSquITh5FDc me1wYFI8+0AcXmPj9ameun83h8tbAFaCzlBQVnK9wL0CfDhdWHFsRLu+6RaIUliQg3mx FEvcu8Ar1zcLaMHBuLvh3rsYsOfl0C2RlyfjNt65BG+ROrPNebXJjL0UYf9LxR0gYO5q 4Entvu6OAzKq+H8KYWL1LRp/fdJbWViG6JTmq3xbcl9LNkt596K8wSd8/aHFGmc4lO1e VG0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Qj2zBbkIxBGfCERuHV86VP5E7OnuA4mxy13S+8Juj1A=; b=hIKYMCkMYOe5cronsbjOOqb9OdjcsYX18ZA1r6mT2Iy5ZG0bFYNb4JzXWzCCmdWrcA AShK5bohZwQdzn2DHjKJ8/oxP7kIL5cnAEPnbYBE9+mMnkU3Lyknjxl+3x4i0r3FoUKf FsDlKaDspbRaCZmPlkO8IokTvDmTlLtv3fwh3EeYmUnj6AIwr+5GUo2qSFwYKx4HSniD 0Cxc9+9TChubyyeVRlYX9xqNdRUnSa4PQsFudw6zyjXGLSHlZSmwb86RJul9YimA8Bz2 Cyw/WTql/lW4P5Cs7H8VSodgHq0ypgC5tAG+Wc5PX+GSm4pfNVLurBAnR+GJOX85TN3W +seQ== X-Gm-Message-State: APjAAAVx6uszsoNCIgmg8JNBWKLxvoGrQyv/Bf6/qhKvcaEcXjKc/GE/ mBswAywadhzbxwoBoftkZ6qNOseT/gN+hHKbMOO3QQ== X-Google-Smtp-Source: APXvYqwRusIwUk6lCNfxmnhsTV8VjQlzho9wFmoZfuZX08t6lIpHqT7y+O10DM3NmqSYkj2omYk5blRS2XoRospyutQ= X-Received: by 2002:a25:b949:: with SMTP id s9mr5305834ybm.274.1581725496112; Fri, 14 Feb 2020 16:11:36 -0800 (PST) MIME-Version: 1.0 References: <20200214222415.181467-1-shakeelb@google.com> In-Reply-To: From: Eric Dumazet Date: Fri, 14 Feb 2020 16:11:24 -0800 Message-ID: Subject: Re: [PATCH v2] cgroup: memcg: net: do not associate sock with unrelated cgroup To: Shakeel Butt Cc: Johannes Weiner , Tejun Heo , Greg Thelen , Michal Hocko , Vladimir Davydov , Andrew Morton , Cgroups , linux-mm , Roman Gushchin , LKML Content-Type: text/plain; charset="UTF-8" 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: On Fri, Feb 14, 2020 at 4:04 PM Shakeel Butt wrote: > > On Fri, Feb 14, 2020 at 3:12 PM Eric Dumazet wrote: > > > > On Fri, Feb 14, 2020 at 2:48 PM Shakeel Butt wrote: > > > > > > > > I think in the current code if the association is skipped at > > > allocation time then the sock will remain unassociated for its > > > lifetime. > > > > > > Maybe we can add the association in the later stages but it seems like > > > it is not a simple task i.e. edbe69ef2c90f ("Revert "defer call to > > > mem_cgroup_sk_alloc()""). > > > > Half TCP sockets are passive, so this means that 50% of TCP sockets > > won't be charged. > > (the socket cloning always happens from BH context) > > > > I think this deserves a comment in the changelog or documentation, > > otherwise some people might think > > using memcg will make them safe. > > Thanks I will update the changelog. Also is inet_csk_accept() the > right place for delayed cgroup/memcg binding (if we decide to do > that). I am wondering if we can force charge the memcg during late > binding to cater the issue fixed in edbe69ef2c90f. > Yes, this is exactly why accept() would be the natural choice. You do not want to test/change the binding at sendmsg()/recvmsg() time, right ?