Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1465345pxu; Fri, 27 Nov 2020 07:52:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJyeHO0V4fLC3k4DskG/udr9EWybDuftA4UFOY/q7MSp8aPJknYeGrYMm6iZZ2d5FT9/p/Gu X-Received: by 2002:a50:d6c6:: with SMTP id l6mr8501871edj.80.1606492325813; Fri, 27 Nov 2020 07:52:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606492325; cv=none; d=google.com; s=arc-20160816; b=ZS0kTGhRri5ur+duFiTnF8tYs4q38+TtQIe0Wjg3jDC0xYoH7x8ZPCrs/3o/06sfZP MwkyYOj3PIqoR+mTV+xBj/v3hyJ+z6C3+UelRY9AE0R+DhdFd1UHaNAXnynaCRNtIaQS R5D//0qZhVAgbrKD6ce2Tm211ItmX0u22XKmH+hCU6+enT/BAQqjWXcAHmQcBjkJ4kmI qvUIN9S9ed5V5xW65EBaAg1oC994/3NrVypUKGIHbuqUyEjzjDap4qg2JF/f0IfqSC6B wGus5Wu768rKFjIBLpfXvET6MScZjVGRS3l80evZDo3up29r3TuxIAHyt7I4tN8/CGZL 9Kgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=yUI8JDA/1JWtAknxHnoTbw0NDxakDNSuKrAyyj1YHbI=; b=xRNllDKiLmPcXasFfkwAfvuk0djFePVsxKoM/f8XYWT3iP6qocChOBWJw9Az5ZpO2X c0M887V4Z3YzCfARKFhR7dbBrqNO/gIRFWg+Ygvo5mtoJS5fjH8Uh4FsRIdMnNw+hevD vQPJpQ9FO6uR7+4fmSvcIDbCzTwZelGWUAxUNptw+T4T3LFA+2vv2fem5T2sU7zLo1wF vwq4kwST/TdCGzx6dF1q21ZSirOSz5YkGXE9swR9qnRQjZNa+xZ4DpDxes/EhksWvvQ0 hn5FAZlXz71sDkMV95V1b9CT0NUnEz6BrWHVzN1OEeXNwaRNgsdlqqNLa+LAdDy/rIQH J6ow== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b6si6212616edq.479.2020.11.27.07.51.42; Fri, 27 Nov 2020 07:52:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730945AbgK0Ptr (ORCPT + 99 others); Fri, 27 Nov 2020 10:49:47 -0500 Received: from mx2.suse.de ([195.135.220.15]:38202 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730675AbgK0Ptr (ORCPT ); Fri, 27 Nov 2020 10:49:47 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 67FC6AE30; Fri, 27 Nov 2020 15:49:46 +0000 (UTC) Subject: Re: [PATCH] mm: cma: improve pr_debug log in cma_release() To: Charan Teja Reddy , akpm@linux-foundation.org, iamjoonsoo.kim@lge.com, linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, vinmenon@codeaurora.org References: <1606318341-29521-1-git-send-email-charante@codeaurora.org> From: Vlastimil Babka Message-ID: Date: Fri, 27 Nov 2020 16:49:43 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <1606318341-29521-1-git-send-email-charante@codeaurora.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/25/20 4:32 PM, Charan Teja Reddy wrote: > It is required to print 'count' of pages, along with the pages, passed > to cma_release to debug the cases of mismatched count value passed > between cma_alloc() and cma_release() from a code path. > > As an example, consider the below scenario: > 1) CMA pool size is 4MB and > 2) User doing the erroneous step of allocating 2 pages but freeing 1 > page in a loop from this CMA pool. > The step 2 causes cma_alloc() to return NULL at one point of time > because of -ENOMEM condition. > > And the current pr_debug logs is not giving the info about these types > of allocation patterns because of count value not being printed in > cma_release(). > > We are printing the count value in the trace logs, just extend the same > to pr_debug logs too. > > Signed-off-by: Charan Teja Reddy Acked-by: Vlastimil Babka > --- > mm/cma.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/cma.c b/mm/cma.c > index 7f415d7..07c904b 100644 > --- a/mm/cma.c > +++ b/mm/cma.c > @@ -512,7 +512,7 @@ bool cma_release(struct cma *cma, const struct page *pages, unsigned int count) > if (!cma || !pages) > return false; > > - pr_debug("%s(page %p)\n", __func__, (void *)pages); > + pr_debug("%s(page %p, count %zu)\n", __func__, (void *)pages, count); > > pfn = page_to_pfn(pages); > >