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 646FBC3F68F for ; Sat, 15 Feb 2020 00:04:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 087BD222C4 for ; Sat, 15 Feb 2020 00:04:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="OpzcXXfk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 087BD222C4 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 554406B0003; Fri, 14 Feb 2020 19:04:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4DD5F6B0005; Fri, 14 Feb 2020 19:04:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3A4BF6B0006; Fri, 14 Feb 2020 19:04:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0131.hostedemail.com [216.40.44.131]) by kanga.kvack.org (Postfix) with ESMTP id 1C6EF6B0003 for ; Fri, 14 Feb 2020 19:04:33 -0500 (EST) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id C0336181AEF0B for ; Sat, 15 Feb 2020 00:04:32 +0000 (UTC) X-FDA: 76490414784.05.chin84_a8c775c33417 X-HE-Tag: chin84_a8c775c33417 X-Filterd-Recvd-Size: 4164 Received: from mail-ot1-f65.google.com (mail-ot1-f65.google.com [209.85.210.65]) by imf37.hostedemail.com (Postfix) with ESMTP for ; Sat, 15 Feb 2020 00:04:32 +0000 (UTC) Received: by mail-ot1-f65.google.com with SMTP id r16so10869706otd.2 for ; Fri, 14 Feb 2020 16:04:32 -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=sc3eN5qofsLsz0odXUjAXrrQtgiKgF8fh8BjuXC2JWY=; b=OpzcXXfkrp7UFH3ZK85YabQ88elz5XA6OO/FPNgHZkCMW/kxBKWveumbeQjL/Xav1P ty+v6E4VESghdBWneJyGKa+igJclsO2a1+3vswIplonbl5S+KcdbSPQ9MRbF18yIlU2I dgnwRWUtwnZt3zXEGFDhMWGJh9u+i42Mcn1kCybLYVgeQiyhHacQ7TUUdM+4+U56jaqy d9tdMOE3jWZIvcihxvFqfE8ew7Nux205pr5nJLrYaZCkhW/yXfL3YjxoECuwcIckYZHm qFG5VsR/2Ok/XAzuGw700He0YIDDQ1KHzWkBVK+S3C0h01QsVZVUYaSQ4MPyi0ROMS+g hsaA== 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=sc3eN5qofsLsz0odXUjAXrrQtgiKgF8fh8BjuXC2JWY=; b=VAHetvcw21uJLStfYNpyAPlaB1YTVdY7XPeF1Gi8xjSMKZhLryd49kxCBIdc3L1iUr DvQUVQ5caMMl7qbE0Vx9I5X1y6h6P0iqxOUqX2U52gkD0+f/t7fvV8jEC9V9qbNs0X4Y Wp/TV0C8ybML0UAEG2PuQ0hspzdJcb0Ytt0/RP7EIkw5HEsmYlkzQiCyEvnnq4Ew3gwP lysYCW2xcGScw8d2TsYGdFPXB7nfBtMd2sXk7nX8f8xtMXrow2M0GlXJWiECbE/Pbcbk XIrlGs/0OGO1S5BDNZuCM3oxmP993mfRgHwxBUNV9AShKBDypqcLnvB82aea2O1gzhiC o/Og== X-Gm-Message-State: APjAAAXHsXFmomlW9KcQZJu3Y3u0f/44Mo+u58MLz9PCJ1yIGK90rrd2 Ylgnlgeta0SGWCr6SX5kJ3O+zEeNOferjUfo6LGGrQ== X-Google-Smtp-Source: APXvYqzAjeek3/OrstwZ6dIH3DyJHOy/lz/gOfLKkozBzmnuWgnJCL9xr1l1yC1jWdBYvGnudU8ofd4dG/8syTmByoQ= X-Received: by 2002:a9d:6ac2:: with SMTP id m2mr4317523otq.191.1581725071308; Fri, 14 Feb 2020 16:04:31 -0800 (PST) MIME-Version: 1.0 References: <20200214222415.181467-1-shakeelb@google.com> In-Reply-To: From: Shakeel Butt Date: Fri, 14 Feb 2020 16:04:20 -0800 Message-ID: Subject: Re: [PATCH v2] cgroup: memcg: net: do not associate sock with unrelated cgroup To: Eric Dumazet 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 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. Shakeel