From patchwork Tue Mar 30 22:02:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minchan Kim X-Patchwork-Id: 12173951 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A361BC433C1 for ; Tue, 30 Mar 2021 22:02:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2E810619AB for ; Tue, 30 Mar 2021 22:02:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2E810619AB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B007F6B0082; Tue, 30 Mar 2021 18:02:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A8A156B0085; Tue, 30 Mar 2021 18:02:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8DE3B6B0087; Tue, 30 Mar 2021 18:02:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0136.hostedemail.com [216.40.44.136]) by kanga.kvack.org (Postfix) with ESMTP id 6D8726B0082 for ; Tue, 30 Mar 2021 18:02:43 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 2E0565DF9 for ; Tue, 30 Mar 2021 22:02:43 +0000 (UTC) X-FDA: 77977915806.26.3A367D9 Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) by imf21.hostedemail.com (Postfix) with ESMTP id 74236E0011D9 for ; Tue, 30 Mar 2021 22:02:42 +0000 (UTC) Received: by mail-pg1-f175.google.com with SMTP id i6so5533821pgs.1 for ; Tue, 30 Mar 2021 15:02:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=x1Tf27hLCUXsjwagiwK93HjbjfAF6ka0w+D0kxkF1lk=; b=djaOrOd+quxNbbpMA1466B+wEKnLIJ+8ATvawoG8KLRyViDGl0fiuPZSh+cx5BJUU7 iI5tZmzhdQM2VIpNmSM79wh2vAbouDnhYY64qaWiTyhx4KURake8hHoGw3o0nJ6rLhuI ps39DrukwlADP9bc5sfoofgY7gXXOuuK9tkTfaYTNBRCfiX9ldTH1xWQ26qCMGDgOTQ9 49dL6JYYNBtFLVzsEsBC5Ujkq6WCH3ve3GKLAjIIF/t2AxArj45qE+DiNAGNT2p1bW05 0UMaep2f+QbmSx3y4jzppWR5jRz/AjLC81pr7mz5q7oDI0+RE4kWamkWL+fOwkdCfILf dq5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=x1Tf27hLCUXsjwagiwK93HjbjfAF6ka0w+D0kxkF1lk=; b=W4z2qaPYdJxaREKTYH9U6Y9Hl2/3nBlD0IRBLdGbUnQU0VN0A+WeyKjAbwnWr6AgUw OH43iAGVEKmWUfOJq37O/3h6y8FglVo3+wvZVO/aQdF1E5EjE/JUeqiuQfCFgi7h++JQ j9Ghg8E07Uhf6tu422WQcP/aIequM0C0YhJ8FUOFk4vqYhrIJyWF3idLIY6LO/8M9Yn3 WieLm+ZLynudaKWvTsP7KDlGi/Qx2n8MQtl0HTleQRboMJJ2STNSMwtjDDo/R2VQKQJt TQlzjuroRlR03ckmkCJHxUQib4cdBhasWMuTqVzZ1WoVDUQM+jYpni26KJJo6YiBbLnd plwA== X-Gm-Message-State: AOAM531KFOilt+ujjeK4MPx4JiCtAhZ8nKv2MrjuJUh/rGe3tvmNTAMm rwLkExzQlcPsNJY7TB0V0rs= X-Google-Smtp-Source: ABdhPJzgSUBmlDaRWfK168J1PvsA7rY0M8T60O6r6My0ulvn35+8mKjSkpiW/P59T2O4J3jmYmyBuA== X-Received: by 2002:a63:3686:: with SMTP id d128mr213051pga.331.1617141761684; Tue, 30 Mar 2021 15:02:41 -0700 (PDT) Received: from bbox-1.mtv.corp.google.com ([2620:15c:211:201:e1ca:cef0:ac9e:7cda]) by smtp.gmail.com with ESMTPSA id i17sm24882pfq.135.2021.03.30.15.02.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Mar 2021 15:02:40 -0700 (PDT) From: Minchan Kim To: Andrew Morton Cc: linux-mm , LKML , joaodias@google.com, Minchan Kim , Liam Mark , Georgi Djakov Subject: [PATCH] mm: cma: add the CMA instance name to cma trace events Date: Tue, 30 Mar 2021 15:02:37 -0700 Message-Id: <20210330220237.748899-1-minchan@kernel.org> X-Mailer: git-send-email 2.31.0.208.g409f899ff0-goog MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 74236E0011D9 X-Stat-Signature: fgwn6mp5fauzzei8pwxaihtf1km471dj Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf21; identity=mailfrom; envelope-from=""; helo=mail-pg1-f175.google.com; client-ip=209.85.215.175 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1617141762-517233 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: There were missing places to add cma instance name. To identify each CMA instance, let's add the name for every cma trace. This patch also changes the existing cma_trace_alloc to cma_trace_finish since we have cma_alloc_start[1]. [1] https://lore.kernel.org/linux-mm/20210324160740.15901-1-georgi.djakov@linaro.org Cc: Liam Mark Cc: Georgi Djakov Signed-off-by: Minchan Kim --- include/trace/events/cma.h | 28 +++++++++++++++++----------- mm/cma.c | 7 ++++--- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/include/trace/events/cma.h b/include/trace/events/cma.h index be1525a10457..5cf385ae7c08 100644 --- a/include/trace/events/cma.h +++ b/include/trace/events/cma.h @@ -10,12 +10,13 @@ DECLARE_EVENT_CLASS(cma_alloc_class, - TP_PROTO(unsigned long pfn, const struct page *page, + TP_PROTO(const char *name, unsigned long pfn, const struct page *page, unsigned int count, unsigned int align), - TP_ARGS(pfn, page, count, align), + TP_ARGS(name, pfn, page, count, align), TP_STRUCT__entry( + __string(name, name) __field(unsigned long, pfn) __field(const struct page *, page) __field(unsigned int, count) @@ -23,13 +24,15 @@ DECLARE_EVENT_CLASS(cma_alloc_class, ), TP_fast_assign( + __assign_str(name, name); __entry->pfn = pfn; __entry->page = page; __entry->count = count; __entry->align = align; ), - TP_printk("pfn=%lx page=%p count=%u align=%u", + TP_printk("name=%s pfn=%lx page=%p count=%u align=%u", + __get_str(name), __entry->pfn, __entry->page, __entry->count, @@ -38,24 +41,27 @@ DECLARE_EVENT_CLASS(cma_alloc_class, TRACE_EVENT(cma_release, - TP_PROTO(unsigned long pfn, const struct page *page, + TP_PROTO(const char *name, unsigned long pfn, const struct page *page, unsigned int count), - TP_ARGS(pfn, page, count), + TP_ARGS(name, pfn, page, count), TP_STRUCT__entry( + __string(name, name) __field(unsigned long, pfn) __field(const struct page *, page) __field(unsigned int, count) ), TP_fast_assign( + __assign_str(name, name); __entry->pfn = pfn; __entry->page = page; __entry->count = count; ), - TP_printk("pfn=%lx page=%p count=%u", + TP_printk("name=%s pfn=%lx page=%p count=%u", + __get_str(name), __entry->pfn, __entry->page, __entry->count) @@ -85,20 +91,20 @@ TRACE_EVENT(cma_alloc_start, __entry->align) ); -DEFINE_EVENT(cma_alloc_class, cma_alloc, +DEFINE_EVENT(cma_alloc_class, cma_alloc_finish, - TP_PROTO(unsigned long pfn, const struct page *page, + TP_PROTO(const char *name, unsigned long pfn, const struct page *page, unsigned int count, unsigned int align), - TP_ARGS(pfn, page, count, align) + TP_ARGS(name, pfn, page, count, align) ); DEFINE_EVENT(cma_alloc_class, cma_alloc_busy_retry, - TP_PROTO(unsigned long pfn, const struct page *page, + TP_PROTO(const char *name, unsigned long pfn, const struct page *page, unsigned int count, unsigned int align), - TP_ARGS(pfn, page, count, align) + TP_ARGS(name, pfn, page, count, align) ); #endif /* _TRACE_CMA_H */ diff --git a/mm/cma.c b/mm/cma.c index b2393b892d3b..de6b9f01be53 100644 --- a/mm/cma.c +++ b/mm/cma.c @@ -486,12 +486,13 @@ struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align, pr_debug("%s(): memory range at %p is busy, retrying\n", __func__, pfn_to_page(pfn)); - trace_cma_alloc_busy_retry(pfn, pfn_to_page(pfn), count, align); + trace_cma_alloc_busy_retry(cma->name, pfn, pfn_to_page(pfn), + count, align); /* try again with a bit different memory target */ start = bitmap_no + mask + 1; } - trace_cma_alloc(pfn, page, count, align); + trace_cma_alloc_finish(cma->name, pfn, page, count, align); /* * CMA can allocate multiple page blocks, which results in different @@ -551,7 +552,7 @@ bool cma_release(struct cma *cma, const struct page *pages, unsigned int count) free_contig_range(pfn, count); cma_clear_bitmap(cma, pfn, count); - trace_cma_release(pfn, pages, count); + trace_cma_release(cma->name, pfn, pages, count); return true; }