From patchwork Thu Mar 21 20:01:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Busch X-Patchwork-Id: 10864269 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2F4FD1575 for ; Thu, 21 Mar 2019 20:03:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0EAB42A45C for ; Thu, 21 Mar 2019 20:03:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 033722A47F; Thu, 21 Mar 2019 20:03:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B4EB32A45C for ; Thu, 21 Mar 2019 20:03:56 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 208E5219493E6; Thu, 21 Mar 2019 13:03:49 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.126; helo=mga18.intel.com; envelope-from=keith.busch@intel.com; receiver=linux-nvdimm@lists.01.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 637CD2194EB70 for ; Thu, 21 Mar 2019 13:02:59 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Mar 2019 13:02:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,254,1549958400"; d="scan'208";a="309246248" Received: from unknown (HELO localhost.lm.intel.com) ([10.232.112.69]) by orsmga005.jf.intel.com with ESMTP; 21 Mar 2019 13:02:58 -0700 From: Keith Busch To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-nvdimm@lists.01.org Subject: [PATCH 5/5] mm/migrate: Add page movement trace event Date: Thu, 21 Mar 2019 14:01:57 -0600 Message-Id: <20190321200157.29678-6-keith.busch@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20190321200157.29678-1-keith.busch@intel.com> References: <20190321200157.29678-1-keith.busch@intel.com> X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dave Hansen MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP Trace the source and destination node of a page migration to help debug memory usage. Signed-off-by: Keith Busch --- include/trace/events/migrate.h | 26 ++++++++++++++++++++++++++ mm/migrate.c | 1 + 2 files changed, 27 insertions(+) diff --git a/include/trace/events/migrate.h b/include/trace/events/migrate.h index d25de0cc8714..3d4b7131e547 100644 --- a/include/trace/events/migrate.h +++ b/include/trace/events/migrate.h @@ -6,6 +6,7 @@ #define _TRACE_MIGRATE_H #include +#include #define MIGRATE_MODE \ EM( MIGRATE_ASYNC, "MIGRATE_ASYNC") \ @@ -71,6 +72,31 @@ TRACE_EVENT(mm_migrate_pages, __print_symbolic(__entry->mode, MIGRATE_MODE), __print_symbolic(__entry->reason, MIGRATE_REASON)) ); + +TRACE_EVENT(mm_migrate_move_page, + + TP_PROTO(struct page *from, struct page *to, int status), + + TP_ARGS(from, to, status), + + TP_STRUCT__entry( + __field(struct page *, from) + __field(struct page *, to) + __field(int, status) + ), + + TP_fast_assign( + __entry->from = from; + __entry->to = to; + __entry->status = status; + ), + + TP_printk("node from=%d to=%d status=%d flags=%s refs=%d", + page_to_nid(__entry->from), page_to_nid(__entry->to), + __entry->status, + show_page_flags(__entry->from->flags & ((1UL << NR_PAGEFLAGS) - 1)), + page_ref_count(__entry->from)) +); #endif /* _TRACE_MIGRATE_H */ /* This part must be outside protection */ diff --git a/mm/migrate.c b/mm/migrate.c index 83fad87361bf..d97433da12c0 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -997,6 +997,7 @@ static int move_to_new_page(struct page *newpage, struct page *page, page->mapping = NULL; } out: + trace_mm_migrate_move_page(page, newpage, rc); return rc; }