Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp1043178ybm; Wed, 22 May 2019 16:23:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqweHvq2t4yuAF5qRLFSlBqUYuVPYtY2vQjxj5XY+CHcpgKG5nVG6qFa7EUA/DR0aIVSUir8 X-Received: by 2002:a62:cdc6:: with SMTP id o189mr72325443pfg.74.1558567388160; Wed, 22 May 2019 16:23:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558567388; cv=none; d=google.com; s=arc-20160816; b=AgATQvl2hqEfk/JrF+fP/yafIm2DYDo4j/4yL78GrHS4unpq9gBom4ICsO/zcc3WqE FQnB28LIG6HDVN94VJBlHLoZ6fQAAfWvr94X8gpWmNe5s8rc6tKVoxJigl0/dkYlvhOE p3BUX9tleTxwlngwfRkbIcPwQz4LrAyCmKAhkqClrvpaRhxpsRB6xXlG2JCPJewP6Tt5 vc4cIgYyY6Bd8DyD/sDW2WEzZjt+/abzRe5ni/73qig0bhwjbeZZA4GkZuT3XhMv78zL GlqLwmWqHey17DA4WCt9VIw1wrvZ+xYmIbxFNCS2Mv5u4QT09oFlyH6Qm/we2UJOvOJV prHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject :smtp-origin-cluster:cc:to:smtp-origin-hostname:from :smtp-origin-hostprefix:dkim-signature; bh=X6P44zjZ47fHY3Lb/kucsCI8qXASyw0JnvINTZV+gOs=; b=fI/PyEhudEfaNwt4HZNZL9ZAqUB0tQDywgGiIYZgQ48u3sCRMuD38n5iYCIIxVX4Q4 le3+ISJp7INNr60LhfZlcqetPmhP5liY0cETY2j0XXeNtQ4ElCGN0V5XXxdY+ihrj/Hf dzrfE3VzrP4Klg07ANU2K/qK0c5TXQR6QwMg64xuGI2pqeL6STLI82mgwdUTD31ge0Ts zXV4BhTA+xXTC8vUID/rsk4jFDhesQ1LpCtD2FE4LUIYxvUcLzUsQ+6TBJ0PPldVF+LF dL2eAVN8vkHFalETjWMSZGboUIbdGY4YETSX2UeHIgjpuBcg0YDrkgcAPg02Qdq0pcWr t2ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=TfuFpW4L; 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=NONE sp=NONE dis=NONE) header.from=fb.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bb4si18263207plb.432.2019.05.22.16.22.52; Wed, 22 May 2019 16:23:08 -0700 (PDT) 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=@fb.com header.s=facebook header.b=TfuFpW4L; 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=NONE sp=NONE dis=NONE) header.from=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729809AbfEVXVI (ORCPT + 99 others); Wed, 22 May 2019 19:21:08 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:45676 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729683AbfEVXU6 (ORCPT ); Wed, 22 May 2019 19:20:58 -0400 Received: from pps.filterd (m0044008.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x4MNEGmN008450 for ; Wed, 22 May 2019 16:20:58 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=facebook; bh=X6P44zjZ47fHY3Lb/kucsCI8qXASyw0JnvINTZV+gOs=; b=TfuFpW4L8bxHJ7DQctRXJeWF5d9O646Y+aS27Chd/28P9CVv6t73NQ4c7xRQ73ukJrkX 94xZ2jUNnZcPR0c63EwPB539Tga5PwRMfVTNrKhOX6AtyJJW+mOLsvTYA6sYnRrKfi45 M8K1GAEAMpyiDdMc/mZyKFvil+qWfczQg0U= Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com with ESMTP id 2sn8b0svms-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Wed, 22 May 2019 16:20:57 -0700 Received: from mx-out.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:82::d) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 22 May 2019 16:20:55 -0700 Received: by devvm2643.prn2.facebook.com (Postfix, from userid 111017) id DF3DC12526D44; Wed, 22 May 2019 16:20:53 -0700 (PDT) Smtp-Origin-Hostprefix: devvm From: Roman Gushchin Smtp-Origin-Hostname: devvm2643.prn2.facebook.com To: Alexei Starovoitov , CC: Daniel Borkmann , , Tejun Heo , , , Stanislav Fomichev , , Roman Gushchin Smtp-Origin-Cluster: prn2c23 Subject: [PATCH v2 bpf-next 0/4] cgroup bpf auto-detachment Date: Wed, 22 May 2019 16:20:47 -0700 Message-ID: <20190522232051.2938491-1-guro@fb.com> X-Mailer: git-send-email 2.17.1 X-FB-Internal: Safe MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-05-22_14:,, signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=598 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905220162 X-FB-Internal: deliver Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patchset implements a cgroup bpf auto-detachment functionality: bpf programs are attached as soon as possible after removal of the cgroup, without waiting for the release of all associated resources. Patches 2 and 3 are required to implement a corresponding kselftest in patch 4. v2: 1) removed a bogus check in patch 4 2) moved buf[len] = 0 in patch 2 Roman Gushchin (4): bpf: decouple the lifetime of cgroup_bpf from cgroup itself selftests/bpf: convert test_cgrp2_attach2 example into kselftest selftests/bpf: enable all available cgroup v2 controllers selftests/bpf: add auto-detach test include/linux/bpf-cgroup.h | 8 +- include/linux/cgroup.h | 18 +++ kernel/bpf/cgroup.c | 25 ++- kernel/cgroup/cgroup.c | 11 +- samples/bpf/Makefile | 2 - tools/testing/selftests/bpf/Makefile | 4 +- tools/testing/selftests/bpf/cgroup_helpers.c | 57 +++++++ .../selftests/bpf/test_cgroup_attach.c | 145 ++++++++++++++++-- 8 files changed, 243 insertions(+), 27 deletions(-) rename samples/bpf/test_cgrp2_attach2.c => tools/testing/selftests/bpf/test_cgroup_attach.c (79%) -- 2.20.1