Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp2186892ybm; Thu, 23 May 2019 12:47:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqzFpYIq5rHWYgzrVTbrRvBIVoMOsT/X2n7a0jk6wq+L6p3rEDSsIyvCUHOVcUG5M74YNeO7 X-Received: by 2002:a63:e616:: with SMTP id g22mr33203300pgh.61.1558640869679; Thu, 23 May 2019 12:47:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558640869; cv=none; d=google.com; s=arc-20160816; b=NxD0bKvJjiQvKERtjzEvVHt/zl5OnHrjB/iI5FfSBSiYj9FAAev2rAViYkN8+AL+wk SGVPXv9GgQzaDYn3DTaAHwHkK11sMQV/zfTVuXno/WmeCHxJPY87b9zORdvLP/zpZ1Y+ UWK7QRwk8cPGL1vagDHK9TdyWrN6w8w7bjXgIAxujcSeA0IbRweE9ghs3j38emndQQ6a K2Ou2axGWOiRIf7+IluoNWSDJ6zWffSdtvy5U0YiP1S3TVcKIq76UJ4tdtU+PgE2WWlJ BRr2lcDVSuGPoKfA4ZKXpzqjJ4MlSwDFiswFSVXZTB9zPd5+E5zyIQ0O/+AH7OAW3IdS kNLw== 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=1dJ4AOqI7Vb5uxtGciryBBpr5z5NcrrzB+SsZr5O+/U=; b=PC5iNqxWaNlYRZI956xoji4ziMElXXq+ljSnQQyTHGxdBfFSPbCtZKz9yMV148YTos knrtyvMEAvDWva7jnWQ5vIMU6ulfrOkM0saOAzkjPKSyoflVm7/aYSWn64PQKmrb5WUM 3vVwBedzoa5nGz19oARqt1xd/MoZFsoPsNwlUAiHjydINNEXSKxyEn5hVeMIP9MEtZlH SFdiGx29IuC/bYvoxZ0kMyyFiOHfcERi61AP3pLhBO37nhTWP1RHfdC/6NPZfIfNkXW6 wzgF1pID/9XzF7QcDkX7ZoEytyp+aEgY8hIIx5xAL33q9mQKtX3FJieyRu6bGaeJV1Sv C5jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=QrLRIfHS; 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 x191si356088pfd.37.2019.05.23.12.47.34; Thu, 23 May 2019 12:47:49 -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=QrLRIfHS; 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 S2389439AbfEWTqT (ORCPT + 99 others); Thu, 23 May 2019 15:46:19 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:35880 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389327AbfEWTqQ (ORCPT ); Thu, 23 May 2019 15:46:16 -0400 Received: from pps.filterd (m0148461.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x4NJguHc006984 for ; Thu, 23 May 2019 12:46:16 -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=1dJ4AOqI7Vb5uxtGciryBBpr5z5NcrrzB+SsZr5O+/U=; b=QrLRIfHSf86jnlYF71TU6L5NTcXbSoN6ZBYybFJdPfV4PpRN+T9codlvhhBEibQlFycI q0Hop9wVQbXyud0jCaKqjWQE+lppQ5UcsI/+Z/6zy0ziAvJVoqFg57pvrHSpJXav5/od PGwbbssvyEKI3KB1lwNNHlYn+ZFlg7/HR/k= Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com with ESMTP id 2snuq59gg2-9 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 23 May 2019 12:46:15 -0700 Received: from mx-out.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:82::e) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 23 May 2019 12:46:10 -0700 Received: by devvm2643.prn2.facebook.com (Postfix, from userid 111017) id 4B0F2125B047E; Thu, 23 May 2019 12:45:33 -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 , Yonghong Song , , Roman Gushchin Smtp-Origin-Cluster: prn2c23 Subject: [PATCH v3 bpf-next 0/4] cgroup bpf auto-detachment Date: Thu, 23 May 2019 12:45:28 -0700 Message-ID: <20190523194532.2376233-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-23_16:,, 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=730 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905230128 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 detached 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. v3: 1) some minor changes and typo fixes 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 | 146 ++++++++++++++++-- 8 files changed, 243 insertions(+), 28 deletions(-) rename samples/bpf/test_cgrp2_attach2.c => tools/testing/selftests/bpf/test_cgroup_attach.c (79%) -- 2.20.1