From patchwork Thu Aug 11 13:15:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charan Teja Kalla X-Patchwork-Id: 12941434 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2EC8EC25B0D for ; Thu, 11 Aug 2022 13:16:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 789406B0073; Thu, 11 Aug 2022 09:16:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 711906B0074; Thu, 11 Aug 2022 09:16:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5B1C56B0075; Thu, 11 Aug 2022 09:16:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 488B86B0073 for ; Thu, 11 Aug 2022 09:16:07 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 146001C702B for ; Thu, 11 Aug 2022 13:16:07 +0000 (UTC) X-FDA: 79787359974.09.AF7BDC4 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by imf13.hostedemail.com (Postfix) with ESMTP id 7EB81201A6 for ; Thu, 11 Aug 2022 13:16:06 +0000 (UTC) Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27BCJet5012200; Thu, 11 Aug 2022 13:16:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=qcppdkim1; bh=ZSJevoEo0/gXYnJN6XjQELpSgkgJvag66N3XNH5+np8=; b=eNrvVSmPJjnMAjj6NcoM8JOJP+Gp+Wj+Clh6KsQBZimzXS480vBqwAzEu6YfV4jfsCDz HA0HKHnaX4DZmL6OwXKaIkDhQ3nswadjNQi04XIq6L6k4fjgEY45V1paW8psICmBw3IS JCcCgoDRiAXtZxZ/Ypfc+8gTHHNhpLW79ju28ldKqPwgItaC2uq6omIQAJTAf2G1pyy7 qUCG3VTUUHX63RSnbdoRKU3+CHSm7AsS/r25E7flC7qXnjEgggvRKQBvoePhTLBqFTSK inrowKTTLgTw7gxj1sEpmAJpBeaT357eP9kFZEFcJ3o6+AxzbhTMXWMoXtj1ZPqYz2a6 PQ== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3huwr8x45a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 11 Aug 2022 13:16:01 +0000 Received: from pps.filterd (NALASPPMTA03.qualcomm.com [127.0.0.1]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 27BDG0nt028457; Thu, 11 Aug 2022 13:16:00 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NALASPPMTA03.qualcomm.com (PPS) with ESMTPS id 3hshck9bbe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 11 Aug 2022 13:16:00 +0000 Received: from NALASPPMTA03.qualcomm.com (NALASPPMTA03.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 27BDFDVH028134; Thu, 11 Aug 2022 13:16:00 GMT Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (PPS) with ESMTPS id 27BDG0aV028451 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 11 Aug 2022 13:16:00 +0000 Received: from hu-charante-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Thu, 11 Aug 2022 06:15:56 -0700 From: Charan Teja Kalla To: , , , , CC: , , Charan Teja Kalla Subject: [PATCH V2] mm/cma_debug: show complete cma name in debugfs directories Date: Thu, 11 Aug 2022 18:45:29 +0530 Message-ID: <1660223729-22461-1-git-send-email-quic_charante@quicinc.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: vs4fy44rX8cWr3rocS8MD_j03MkYzMnG X-Proofpoint-ORIG-GUID: vs4fy44rX8cWr3rocS8MD_j03MkYzMnG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-11_10,2022-08-11_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 adultscore=0 suspectscore=0 spamscore=0 clxscore=1015 priorityscore=1501 mlxscore=0 phishscore=0 mlxlogscore=482 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2208110042 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660223766; a=rsa-sha256; cv=none; b=Vx/x0j6iJYYFtf+uI6dXFC583xP8BvElXwaDkxzGmdW1l8bf+yJiDZtw1dtRCxSjfCIZlU SY4jY9/63uBl4pX8qIjm4s+Nld0Os8UJYvI4Xqw3JbtU6PR4lEvUJsz0cMnPnT6GetI0Fm 50PIfhPpln2EknvMFW6XCpMJYX+mTjg= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b=eNrvVSmP; spf=pass (imf13.hostedemail.com: domain of quic_charante@quicinc.com designates 205.220.180.131 as permitted sender) smtp.mailfrom=quic_charante@quicinc.com; dmarc=pass (policy=none) header.from=quicinc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660223766; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=ZSJevoEo0/gXYnJN6XjQELpSgkgJvag66N3XNH5+np8=; b=sOIXqtROSn8AB8vUuqOWRenq88jAZ2BX5eAED5u4++vTXxsYxTJADDEytmWHgfCN7p1MBS RrmiqwL6Zeb5w/CWGfAXCJv5aLtFn2orHRBTejB2QEEpzXQXfn+PRmqYsaGItEWOJ3CbJy Ty164naXp8d9YH7ggjDC8Kky4WTNlMk= X-Stat-Signature: xugr6pxps8hx4e6stpohg6qbrsnbt4dy X-Rspamd-Queue-Id: 7EB81201A6 X-Rspam-User: X-Rspamd-Server: rspam03 Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b=eNrvVSmP; spf=pass (imf13.hostedemail.com: domain of quic_charante@quicinc.com designates 205.220.180.131 as permitted sender) smtp.mailfrom=quic_charante@quicinc.com; dmarc=pass (policy=none) header.from=quicinc.com X-HE-Tag: 1660223766-331763 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Currently only 12 characters of the cma name is being used as the debug directories where as the cma name can be of length CMA_MAX_NAME(=64) characters. One side problem with this is having 2 cma's with first common 12 characters would end up in trying to create directories with same name and fails with -EEXIST thus can limit cma debug functionality. The 'cma-' prefix is used initially where cma areas don't have any names and are represented by simple integer values. Since now each cma would be having its own name, drop 'cma-' prefix for the cma debug directories as they are clearly evident that they are for cma debug through creating them in /sys/kernel/debug/cma/ path. Signed-off-by: Charan Teja Kalla --- V2: o Updated the cma_debugfs.rst documentation. Vl: o https://lore.kernel.org/all/1660152485-17684-1-git-send-email-quic_charante@quicinc.com/ Documentation/admin-guide/mm/cma_debugfs.rst | 10 +++++----- mm/cma_debug.c | 5 +---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Documentation/admin-guide/mm/cma_debugfs.rst b/Documentation/admin-guide/mm/cma_debugfs.rst index 4e06ffa..7367e62 100644 --- a/Documentation/admin-guide/mm/cma_debugfs.rst +++ b/Documentation/admin-guide/mm/cma_debugfs.rst @@ -5,10 +5,10 @@ CMA Debugfs Interface The CMA debugfs interface is useful to retrieve basic information out of the different CMA areas and to test allocation/release in each of the areas. -Each CMA zone represents a directory under /cma/, indexed by the -kernel's CMA index. So the first CMA zone would be: +Each CMA area represents a directory under /cma/, represented by +its CMA name like below: - /cma/cma-0 + /cma/ The structure of the files created under that directory is as follows: @@ -18,8 +18,8 @@ The structure of the files created under that directory is as follows: - [RO] bitmap: The bitmap of page states in the zone. - [WO] alloc: Allocate N pages from that CMA area. For example:: - echo 5 > /cma/cma-2/alloc + echo 5 > /cma//alloc -would try to allocate 5 pages from the cma-2 area. +would try to allocate 5 pages from the 'cma_name' area. - [WO] free: Free N pages from that CMA area, similar to the above. diff --git a/mm/cma_debug.c b/mm/cma_debug.c index 2e77049..602fff8 100644 --- a/mm/cma_debug.c +++ b/mm/cma_debug.c @@ -163,11 +163,8 @@ DEFINE_DEBUGFS_ATTRIBUTE(cma_alloc_fops, NULL, cma_alloc_write, "%llu\n"); static void cma_debugfs_add_one(struct cma *cma, struct dentry *root_dentry) { struct dentry *tmp; - char name[16]; - scnprintf(name, sizeof(name), "cma-%s", cma->name); - - tmp = debugfs_create_dir(name, root_dentry); + tmp = debugfs_create_dir(cma->name, root_dentry); debugfs_create_file("alloc", 0200, tmp, cma, &cma_alloc_fops); debugfs_create_file("free", 0200, tmp, cma, &cma_free_fops);