Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1487483rwi; Mon, 10 Oct 2022 17:39:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6oRGlMoLzCyHFE0c2JQ96Hl7ofxVfKVJVzEvpTLLt2lAdFwPWjHwE2rote5MigqK1FoGiV X-Received: by 2002:a17:907:5ce:b0:730:bae0:deb with SMTP id wg14-20020a17090705ce00b00730bae00debmr17308136ejb.181.1665448744063; Mon, 10 Oct 2022 17:39:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665448744; cv=none; d=google.com; s=arc-20160816; b=aOdfMGB2hxKAxRSqRyD2yosCIdXqW5xsyioTTu0XTte8HXWArlnlUAANfGP2V4o+UW g/EB1ndcyKh9evBflTMuPl9l7JSTPThJzLa4QNjwlMIWaKDc/jS4X2e3O+4olovn8hS5 c1d86lezo5cMGAvLKk/iJyp3FnvVRNJnEdOERHLvGPq5Pngy+SSqkKTmJUOyip5okUTk qYAryjkX80kH1P0tJi+nNurRODSWfQNLlM+2rswtNYOiJ6GCbG9sD0kKxNhArcyWGssV rlSIvcfpFZUpaJoU/oKtapiPTgP9teINL0EwgYS2v97N6ImZNJuOPO+XDqzvUiQ+nCm2 nQ+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=5MPkIEvXfnmsvTKOk4MDlNi99CiZEm9rCw/f8+9aBJE=; b=mxhbAIMuWLyWAK7G8qgC4ucU8R/erWVBOxX5K/t05wihbCRQaYdpDpzNbFqkihM1DY M7+WLgtdrZR+Apc6hkFIoqDc1DLt1kj+JNerNsN8NLbEUQhMy6bFXXyvHPyyCCXQjrNc OY2FVWpXiR0IFVC5HrE1vZZZoJ6xSAbbya+QwTYFd5q8oyhTPAlzAJpb+p31mAOxTdJ5 pcASVDI1R5JEQ/vPnl5DNxMEacokfDKWvNZ0jYeqp13bJKFRci4swUH+yy8Ot5PwMxth dPRd1BP65AQrl7U+gbwgpCcyau32HDD3i2ieRxKgMJV8N2mayqhc7dqOCubtmTU18Iw+ bvgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=mWfPotsf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j18-20020a170906255200b00777795f0725si9902909ejb.139.2022.10.10.17.38.38; Mon, 10 Oct 2022 17:39:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=mWfPotsf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229605AbiJKAeH (ORCPT + 99 others); Mon, 10 Oct 2022 20:34:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229577AbiJKAeF (ORCPT ); Mon, 10 Oct 2022 20:34:05 -0400 Received: from mail-pl1-x649.google.com (mail-pl1-x649.google.com [IPv6:2607:f8b0:4864:20::649]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E27385E654 for ; Mon, 10 Oct 2022 17:34:03 -0700 (PDT) Received: by mail-pl1-x649.google.com with SMTP id j3-20020a170902da8300b001782a6fbc87so8688534plx.5 for ; Mon, 10 Oct 2022 17:34:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=5MPkIEvXfnmsvTKOk4MDlNi99CiZEm9rCw/f8+9aBJE=; b=mWfPotsftp8geA/L8mN84Y3UjYw9VeNIycJIvsZyy5yDxqJzmCwGBb9gaWdJV61voB JNWi/dHUJ/RKSzdweI2aUtBeEA+hnuFilAe+ELgKi/1CDGO4GXwIWUgcOkpdDmSZmgYl S+X4BhUfpqX/yE7TDRp17TnlXuDPRpO6dv2MjS/WXn/JvLIhp+pYDO3Nxx0fz/B6YiMB EhiVkK0IGiVr8h1wl1gyzrcd9vj2+d1meBbENrZruSwWxcfYRDhbE+atKn/PT9AUkTHS SexkE8P88iGSv/ALoOaI5BRuHiTcO+mFd2hM7eBBwp+Ciop7u/rpi8M7PIC1eIMl8mx3 Rc/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=5MPkIEvXfnmsvTKOk4MDlNi99CiZEm9rCw/f8+9aBJE=; b=35oxouLbKU528C53J6l3rxC55/Jxrpr3hBueUmZCUmQ3QSh5zhKvTvSn3HFXBq3h4L 9Jha+4bW8jdbDk502kd5l+iQrcVzcXDEzuFfqloqKaEHecd6X3B8hVVU/RFsQcCcyods sxa8NBfXmOAGVkAXOSVhYouXcyKkIZSDB8VNRzIZUn0MWEqCl8sKGqD6zmknimIIkCDX IMmmU3l/Vd7qZO47H903EDYLspajXlJJqjNUSUgGIuDC0x/rNMWGlTzokrucMkBCLPoi ADNHY/jUDAYB1gSm8R2wfiI9Ejqgh+P921RHNy1vzJL640ioWRESYP3N2J+jfEmZ9ge3 HABg== X-Gm-Message-State: ACrzQf0OriIG+r3Hj4XZSZQcTC/sX6Sc+98eFTTzSSYe8X5Jwz1i70Px 5ZTHq8u4dYyPXQcxCKuDlkOpuh4QhQsQEbeF X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2327]) (user=yosryahmed job=sendgmr) by 2002:a17:90b:3d85:b0:20c:8f6a:8298 with SMTP id pq5-20020a17090b3d8500b0020c8f6a8298mr17153378pjb.242.1665448443479; Mon, 10 Oct 2022 17:34:03 -0700 (PDT) Date: Tue, 11 Oct 2022 00:33:57 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.38.0.rc1.362.ged0d419d3c-goog Message-ID: <20221011003359.3475263-1-yosryahmed@google.com> Subject: [PATCH v2 0/2] Support cgroup1 in get from fd/file interfaces From: Yosry Ahmed To: Tejun Heo , Zefan Li , Johannes Weiner , Yonghong Song , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Yosry Ahmed Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org commit f3a2aebdd6fb ("cgroup: enable cgroup_get_from_file() on cgroup1") enabled using cgroup_get_from_file() and cgroup_get_from_fd() on cgroup1, to enable bpf cgroup_iter to attach to cgroup1. Apparently, other callers depended on these functions only supporting cgroup2, so f3a2aebdd6 was reverted. Instead, add new separate interfaces that support both cgroup1 and cgroup2 and use them in bpf cgroup_iter. Yosry Ahmed (2): cgroup: add cgroup_v1v2_get_from_[fd/file]() bpf: cgroup_iter: support cgroup1 using cgroup fd include/linux/cgroup.h | 1 + kernel/bpf/cgroup_iter.c | 2 +- kernel/cgroup/cgroup.c | 50 +++++++++++++++++++++++++++++++++++----- 3 files changed, 46 insertions(+), 7 deletions(-) -- 2.38.0.rc1.362.ged0d419d3c-goog