Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2309524ybv; Fri, 14 Feb 2020 16:05:57 -0800 (PST) X-Google-Smtp-Source: APXvYqxSGpH8tWWVTKtRq1RpZ6p8ERizQ5GZoLLYFMUyD1aZlkjY9jk4aCBHANfXzXUc/DKzrZjD X-Received: by 2002:a05:6830:210d:: with SMTP id i13mr4279053otc.192.1581725156929; Fri, 14 Feb 2020 16:05:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581725156; cv=none; d=google.com; s=arc-20160816; b=JckxybHnIjdIpkmGM/25gUD3rF9s85kJnx4UxoMmTN/9QrdYHKWvN2NEu7HJgTw9N0 yjH876iQj4pTFNIP1Ue+ZGNUUVUigaMHSoeyO6uuOzcQNvYhw0FbCL5urHVYd/jvOg4h mMIhe26blvThCfg03RcQbuAPlkRxxRIGoLlBiTMHXv2K6dGYlFTY+cyexljuL+HbR+2S 6OUCTLVzWz5MooXhv0zA3GAJlltjhW39ayI6Xrkk38tN++LLKLx9rm3S5J6moLV0eftX tJL7nmCnrJqzLZbvjkD8z8vrgBFm6TIvjOFQhFBn7f1Zryx39C5ntpuyps+njceu2fV2 jXhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=sc3eN5qofsLsz0odXUjAXrrQtgiKgF8fh8BjuXC2JWY=; b=0RomYrJAOEWTrrbG92FAlHkhNFqY9oYVXxcZkyCQke6aVax4K04ZWOymSeaT+2kxQ2 Ezjx97mTJcHO2PNlcl4SXHynSb3cFi74hvaGHPynH5HseXFHQYyQUB7Ymhxb+iFQcejA UmKaj/qXNeelK+3vNuQCuOzGYHqzZ1M0/ojhrTRQSLd1mWKUROLZZrrgo3XK2Ictjc5g GloXJRhVTMUzgoo43X6FW1GLDW96VBlzRMqngcFOPU80qYKu2pwU/tReZUxdZfCM6wJ5 ZngVssNabXRVf26QsSPHvJfUtbuT4pDKKuiQegreDL0IwUur0Ezm5GIZmn4V/LhaNKTv SnqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=OpzcXXfk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p22si3672787ota.43.2020.02.14.16.05.44; Fri, 14 Feb 2020 16:05:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=OpzcXXfk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727963AbgBOAEc (ORCPT + 99 others); Fri, 14 Feb 2020 19:04:32 -0500 Received: from mail-ot1-f66.google.com ([209.85.210.66]:34618 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727455AbgBOAEc (ORCPT ); Fri, 14 Feb 2020 19:04:32 -0500 Received: by mail-ot1-f66.google.com with SMTP id j16so10860948otl.1 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=ESbY+Xjlw76oZOkTaWcDzQPD65AXzpqiVNDPbBXmSZW/4l3IqnVfuBT5C4dT7FirhB aP7Ahx8Cft8GsrjLbYVtWKJAcoSsmhPKOxNajmGE/RY2PKe2oIZ6dNc6qRX/8D2ist6b aAJxaJvA2XXM0JfNihqDEkRmCEywOTfaPvwIgUx57wK1Zl/oNmp9IPr29NPq4//Y6irE batU9GMCMJ7uTYmnmz5Rn3AhHj0ugsomuWwrdvjV4eYDlmqGYVezl+PYCdqGwEJpAGOv /aPVqd7hGt0DjHCiPj31RCSujdjXGXCM2QyW7WlOb6boZON4YJ26R4yec8KsSuD+ZRb9 76Nw== X-Gm-Message-State: APjAAAW8VmFBqZM2AMrwKpnpSSjlsAVWcRyZOOF6cT5pOIPSvZxRnX3L Sjpr8M2P63Z533crXW4MCCLrJOLhmCCHhg0X7c31Og== 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" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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