From patchwork Sat Jun 10 03:57:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 105891 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1354741vqr; Fri, 9 Jun 2023 22:04:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ44XT6cCVGm42uQugLPFyjDGUMaFGzPxnuOpbn9OPhW/WbJuK8sVtf6Ixf85g/JBCuijvgy X-Received: by 2002:a05:6a00:1708:b0:651:ce88:27f5 with SMTP id h8-20020a056a00170800b00651ce8827f5mr4587922pfc.13.1686373484541; Fri, 09 Jun 2023 22:04:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686373484; cv=none; d=google.com; s=arc-20160816; b=A8l4MWWS9wSyfK6r8u2ROmd3T/YKzFtE5tteovMzLLlvsSCACnyHLgC++WOTSLxXlZ AUaqFky0v1hBKzruzqFZ5DSiXKw5wNFzkXcb4r6axpVyJZUVMMJS2XOnH5fwxZ16zfPb ijAbuNbzfcQ+Uimx7Zh/EwGrQUBqYT6hcsIv0SEi0cxhh/r1qHGhmpnmUxDwcjl+fzPs vh7Jug1o12SnjmmXAfvHfLdo3GDhicQk1dy73YSJXidseGS+6BUGiZUztIjILVHszMWF Ao9KBBFIUEwkSUxOYnodi6C5SyGXwH5ozLdCmTTRtWT5QmFlvAY8+plkRa7GbQFx52hS X6YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=pA5tyilpoWZTDq28AI6AxAaY/zlacEE9bKBMAk8FgYs=; b=jF7wSNYx4v6oyFA2cdD8zjNChK1Ve3wKm99EP5YR16DnrdJhxvykNtCu/CTS8olnCu NMfvkRQWNR/3xMz7ppAPThowa+IMo/s+bAX5N5gySJBw9nCNdLRwaZ9KWzwgRaBbqnEH 50ZxIjD+rGY7fmLPIFmxEchVrkkTNKUcaUeH8R6+BY0rwVoCKdl7ABm4uTTVqskbD4C6 SQGiQ2eI29efLUEhb1jT0rsJmHeOnxABrgg6egG+y9UkwuaUEgDiwyjaFoEzmms0q2hB 15c/cwlOSL5MiJQZSZOBQ9V/gm3aUF7m4NlssuHmlDx7aYEhplDid+0BWvCuqQGdbK58 gJww== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h19-20020aa796d3000000b00640f7f287dcsi3482798pfq.174.2023.06.09.22.04.31; Fri, 09 Jun 2023 22:04:44 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231186AbjFJD6A (ORCPT + 99 others); Fri, 9 Jun 2023 23:58:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229461AbjFJD55 (ORCPT ); Fri, 9 Jun 2023 23:57:57 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78D063A8C; Fri, 9 Jun 2023 20:57:56 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4QdPJ86Jj0zLmly; Sat, 10 Jun 2023 11:56:08 +0800 (CST) Received: from huawei.com (10.175.104.170) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Sat, 10 Jun 2023 11:57:54 +0800 From: Miaohe Lin To: , , CC: , , Subject: [PATCH] cgroup: remove unused task_cgroup_path() Date: Sat, 10 Jun 2023 11:57:37 +0800 Message-ID: <20230610035737.1046651-1-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-Originating-IP: [10.175.104.170] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768290762834685387?= X-GMAIL-MSGID: =?utf-8?q?1768290762834685387?= task_cgroup_path() is not used anymore. So remove it. Signed-off-by: Miaohe Lin --- include/linux/cgroup.h | 1 - kernel/cgroup/cgroup.c | 39 --------------------------------------- 2 files changed, 40 deletions(-) diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 567c547cf371..b307013b9c6c 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h @@ -118,7 +118,6 @@ int cgroup_rm_cftypes(struct cftype *cfts); void cgroup_file_notify(struct cgroup_file *cfile); void cgroup_file_show(struct cgroup_file *cfile, bool show); -int task_cgroup_path(struct task_struct *task, char *buf, size_t buflen); int cgroupstats_build(struct cgroupstats *stats, struct dentry *dentry); int proc_cgroup_show(struct seq_file *m, struct pid_namespace *ns, struct pid *pid, struct task_struct *tsk); diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index d0d033a48f61..48278adb7522 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -2364,45 +2364,6 @@ int cgroup_path_ns(struct cgroup *cgrp, char *buf, size_t buflen, } EXPORT_SYMBOL_GPL(cgroup_path_ns); -/** - * task_cgroup_path - cgroup path of a task in the first cgroup hierarchy - * @task: target task - * @buf: the buffer to write the path into - * @buflen: the length of the buffer - * - * Determine @task's cgroup on the first (the one with the lowest non-zero - * hierarchy_id) cgroup hierarchy and copy its path into @buf. This - * function grabs cgroup_mutex and shouldn't be used inside locks used by - * cgroup controller callbacks. - * - * Return value is the same as kernfs_path(). - */ -int task_cgroup_path(struct task_struct *task, char *buf, size_t buflen) -{ - struct cgroup_root *root; - struct cgroup *cgrp; - int hierarchy_id = 1; - int ret; - - cgroup_lock(); - spin_lock_irq(&css_set_lock); - - root = idr_get_next(&cgroup_hierarchy_idr, &hierarchy_id); - - if (root) { - cgrp = task_cgroup_from_root(task, root); - ret = cgroup_path_ns_locked(cgrp, buf, buflen, &init_cgroup_ns); - } else { - /* if no hierarchy exists, everyone is in "/" */ - ret = strscpy(buf, "/", buflen); - } - - spin_unlock_irq(&css_set_lock); - cgroup_unlock(); - return ret; -} -EXPORT_SYMBOL_GPL(task_cgroup_path); - /** * cgroup_attach_lock - Lock for ->attach() * @lock_threadgroup: whether to down_write cgroup_threadgroup_rwsem