From mboxrd@z Thu Jan 1 00:00:00 1970 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 00751EB64DA for ; Fri, 7 Jul 2023 14:13:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 561C86B0072; Fri, 7 Jul 2023 10:13:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4EAB36B0074; Fri, 7 Jul 2023 10:13:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3B20C8D0001; Fri, 7 Jul 2023 10:13:19 -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 1DE806B0072 for ; Fri, 7 Jul 2023 10:13:19 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 6A3EB160DD4 for ; Fri, 7 Jul 2023 14:13:18 +0000 (UTC) X-FDA: 80985008076.29.05147C7 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf26.hostedemail.com (Postfix) with ESMTP id 9DC2D1401B3 for ; Fri, 7 Jul 2023 14:10:08 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=WZJhiHzq; dmarc=none; spf=none (imf26.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1688739009; 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:in-reply-to:references:references:dkim-signature; bh=4y1KiB4O8hGbu3AjjejbE6BG+oeF2nc27k9lwgLOlF8=; b=ttKXy3jlvoiWA3OyNm/tmM/Uz0uT1OjRfVSYH9MwjXgKDEbt6wB07C8O0kP5GDU9elCquB aNE8lCzR6j9a7pMsEnw1xsdt3gBLHJohm+SzwbUNH5DEisn4DiXWn6a1PlFpXGmFtvo4xv zK6e1uGcQtlN+sUW16Ag3lSy012bdkc= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=WZJhiHzq; dmarc=none; spf=none (imf26.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1688739009; a=rsa-sha256; cv=none; b=RPFSxd/6HTEMu5quEtp95CFQ57Tkw5tumDfRTrYhh9oeKjw7CntG8U+H5I+krmLz7E3lFY hCnkcf5PnxEiCWroS3Jnn8OvtpIwi5azb09bhy7z7ho+TkVT9iKeIuCqiI2a7tIPH2eXkI q4Yh2G9fGqS5Lwc4+6xh7FntpaPmAgI= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=4y1KiB4O8hGbu3AjjejbE6BG+oeF2nc27k9lwgLOlF8=; b=WZJhiHzqTMhdm4VzAWcQ++MRa/ q93WzTTCHemzFmR+Z4iz2/btSxpxpcvfsy7cOW3mvgpXmUN5C+WnXCU7hWQVpdIobEc3ixicOV1wV StROGC9XO4B4HievV4m193Wp6+Od4skTLFkKFhHme3cQp1/a+ickU9nDauywmtttGFefEwIhQS+jk E+PdW3Mt7pTH2Cid5vOZN1StLYlb04f2iYclP1aal4Jcxlke86IjDtqaxXhvLMPs6KEEaWeCig0P7 hpD5q96lGayFLGTbgpO3H1Qq0X4OAszLoMeP3Z1S8QPi2QhxjoEdz1U7GEyrEi+MEEAo6RLvR10TA qPcfcLJw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qHm9m-00C51p-3N; Fri, 07 Jul 2023 14:09:58 +0000 Date: Fri, 7 Jul 2023 15:09:58 +0100 From: Matthew Wilcox To: Pintu Agarwal Cc: Anshuman Khandual , Pintu Kumar , linux-kernel@vger.kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org Subject: Re: [PATCH v2] mm: cma: print cma name as well in cma_alloc debug Message-ID: References: <1688668070-8408-1-git-send-email-quic_pintu@quicinc.com> <1688668414-12350-1-git-send-email-quic_pintu@quicinc.com> <26816f0a-7f55-f5ce-b71d-769011f9230f@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 9DC2D1401B3 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: ypi3roy8rzb8xdhn5q5gbnuj7766bj4t X-HE-Tag: 1688739008-816257 X-HE-Meta: U2FsdGVkX19LINP63/QT8lVBkw60QLfkD5MNa2WTknLFp4TbGJoIFvWnbFNVMcx97WA7gC+Rbpgc66ZGknOktWMByHaCP2Vtgzyga9O0RVXAo4UKybhNVT9y5FEH8vTSPkfwdevWTva34Bclp26XfNH5A1MI0o2wHlQ0V20cxNz+C3PH13bq3ybSW2AmzLNDh7opckkvvfCAo0k7tgrJeeoa0QYCmyY/0yF1UEXkSzEE0OZE4aTcxbaHX/yqiWpB7PeLuIhfY2RVpyt4YIkn8LefWngTJ3QhHC6QSLRSXKHKoDiXrfz183k4s6n8lYP0hFf5Q5WDPpA1JyYFfZdUryqVa31VgwFIMqci8rqlXEHwmT8F/dLnLH6qAVcB4YF2+oKyv8ppIyQioxmKwIRbD//WmQNmGCA7KcZLMKq5BYSrGtA01b4OISM2CO0R0vbINVfJSrArG5viRCPOtF0aDsvrf8hbHuuwK4YcQ/nMSjiszUX4F+hz1PzQBHwees29QstQAGpL3diBNZjnBv64EK+ugOTALA0r6VSmJwlWfMDy171IOJwRZn7EVWSh9Wkd83Ubs3M7vMxMcA9Rw3DX9CoqxOi+XDYCZ5dqVH4U8yx0CEpgSyo9PeEc0EQzSAt3EpEsZ8dFCejTx5WKlLWfA01Jt52AG6+oOBbLX0u56h558CpvvUu0pDE5llx9uA+zB9Uv09xEfHPAWIBQxmlh5DLpULIh5z1VCQmM7PTFxDwDPoDiqRtcYu5E+B++PPveTPsAguW8T82attY/etp7GbVhybcGe2smbO/0mQnU34XMb53KBA87l90hGXzKTWahsoYz+C9b+vvvcnV210MF90yP1J6BjaZnbEFertPEdaYBNVV5T3tXuPBXyBXT1rteslogTXEtAKgLCsLoewpA0ZXaXvcmrD4kBN+7SBO9QOZWFall3xEE0AJZRlMzuv1zJhxZ1938F3/GGjztn3U hj8YOEPz z/fbOYXrm1DwCCvDV4s2hdXHzyag2srYnsXA4sui/iFWRbLyzvfxTsIRsP+paNPHqZ5X4L8W+puiiUzpK34Fit1jQuq7mtLH5524v90Y2s+AF6BgGZOXLjFpYxqcD7X8BWzc30YxKql4IS2c1ctiG6nYBkjWjlmv4/57EuhvCE0eHNEpspuLtAlZpsLqa/brh3MSkk9r6DKOW3DTqar+kXBb+7eNxqxgIUN2Vq0nE+nIdLE9YKq9aMwtCli5TrHR4EV3oOi+gCsu5l3954mzRjA0F1F1MrhfEGn5pD9+rItqaNYdnXdXJy5tS/xx1ty1oQKXEbqjuCUzRbFSoaPBO0+hy/6L0nIKw6+ZpbQMaN9orVDbxHyKadWWrWg== 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: On Fri, Jul 07, 2023 at 07:36:20PM +0530, Pintu Agarwal wrote: > On Fri, 7 Jul 2023 at 18:16, Matthew Wilcox wrote: > > > > On Fri, Jul 07, 2023 at 03:57:42PM +0530, Anshuman Khandual wrote: > > > LGTM, cma->name is an identifying attribute for the region for which the allocation > > > request was made. But how about using cma_get_name() helper instead ? Very few call > > > sites have been using the helper. > > > > It's not really a "helper", is it? The function name is longer than > > its implementation. > > > > cma_get_name(cma) > > vs > > cma->name > > > > Plus there's the usual question about whether a "got" name needs to be > > "put" (does it grab a refcount?) > > > > I think it's useful that this function exists since it lets us not expose > > struct cma outside of mm/, but it really should be called cma_name() > > and I don't think we should be encouraging its use within cma.c. > > Also, cma_get_name() is a trivial assignment. > And in one of the previous patches we avoided function calls with > trivial assignments. > https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/kernel/dma/contiguous.c?h=next-20230705&id=5af638931eb374aa0894d8343cee72f50307ef20 > dma-contiguous: remove dev_set_cma_area > > One more question from here: > pr_debug("%s(cma %p, name: %s, count %lu, align %d)\n", __func__, > (void *)cma, cma->name, count, align); > > Do we really need this "cma %p" printing ? > I hardly check it and simply rely on name and count. Printing pointers is almost always a bad idea. Printing the base_pfn might be a good idea to distinguish CMAs which happen to have the same name?