From patchwork Thu Nov 12 18:41:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 11901037 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 54D11697 for ; Thu, 12 Nov 2020 18:41:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CD6BF22227 for ; Thu, 12 Nov 2020 18:41:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="vEOZkbx2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CD6BF22227 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A94CF6B005C; Thu, 12 Nov 2020 13:41:10 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A44706B0068; Thu, 12 Nov 2020 13:41:10 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 90BDA6B006C; Thu, 12 Nov 2020 13:41:10 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0156.hostedemail.com [216.40.44.156]) by kanga.kvack.org (Postfix) with ESMTP id 6145E6B005C for ; Thu, 12 Nov 2020 13:41:10 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 082C03624 for ; Thu, 12 Nov 2020 18:41:10 +0000 (UTC) X-FDA: 77476633500.20.legs27_441795227308 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id E2FC0180C07A3 for ; Thu, 12 Nov 2020 18:41:09 +0000 (UTC) X-Spam-Summary: 1,0,0,d9f6835521f1f670,d41d8cd98f00b204,georgi.djakov@linaro.org,,RULES_HIT:41:355:379:541:800:960:966:973:988:989:1260:1311:1314:1345:1437:1515:1535:1542:1711:1730:1747:1777:1792:2196:2198:2199:2200:2393:2559:2562:2731:3138:3139:3140:3141:3142:3353:3865:3866:3867:3870:3872:3874:4321:4385:5007:6261:6653:7576:7903:10004:11026:11473:11658:11914:12043:12296:12297:12438:12517:12519:12555:12679:13161:13229:13894:14181:14394:14721:21080:21444:21451:21627:21990:30051:30054,0,RBL:209.85.221.67:@linaro.org:.lbl8.mailshell.net-62.14.0.100 66.201.201.201;04yfirzkgcs5h7961n3fgdkhw1t9dop1jfjn91ihub6wp5pf9b6fhf9fkn1heto.7y7e4edoq4yrf9pbwwxnxt3qe33sss435qzaa4mp7jq1rmdi3dspjenceqi458h.1-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:69,LUA_SUMMARY:none X-HE-Tag: legs27_441795227308 X-Filterd-Recvd-Size: 5055 Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by imf37.hostedemail.com (Postfix) with ESMTP for ; Thu, 12 Nov 2020 18:41:09 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id k2so7123098wrx.2 for ; Thu, 12 Nov 2020 10:41:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/FQifl2y/j+iEx8t0YMS3kt6V2EmV6dxDAOzQF7gB4U=; b=vEOZkbx2w3SP32uR8e7Lzk7IQgr/PYOT3VEpmgSXA6fjRucCT1UModuNyvGUR7TyNp 6Id+d9D9Wow+23Fhev03aSd1zuLQ7OubdKGUxxb+Qlooa4H+7KdEifb+K/nQiIPRgFWW 8dugz9HgIM0b5BWbG9VCZLObhygBFDcEeSQDqjsXYatkYn7sPzrz/8HbC+L/+iWpEW+p lNH6/FB8yscIzl4M9WGItzRqXNv0+QQ7t14+bYS0mYiDFqWql80zc3Z9snZtlh37YSza a/XrIUY24oDAzHF0jnBmWsFu3z2WbvFUS1QXQMU8fk01ww/XyWC6mrb5HuuAE5fCfuKa 0l5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/FQifl2y/j+iEx8t0YMS3kt6V2EmV6dxDAOzQF7gB4U=; b=Fo/wiWvgzfSpLBS5glIM6lAfpuuY8gdkPaF/dlclM8EP5XNe7WLZwajYhAom9G+0qr yyXzPMedScjUsewz77OJxgjA2CN+5RGmy3N/B6AHom04pwJgJryvk416nsWEAOM6KxkB CeTv95tepESIJr4VcGyjzM3kIDRsPmBa1v/te1Mj7uO3Ne1hjyg/nw8LQ/ttsbaHFSVE knFTnM66fEF58amiRBBAZgXjb/gHTbswTccWDnjBU5IBIRCB3lKq3zMXin+MsUfwFhIV xGPXYvDMUTdBthbU7U77aw/3BY53DQsNlVQTLmQLBrn7UE8c1FI1whbS0isp2+a4cKJ6 5gZQ== X-Gm-Message-State: AOAM5323d9z4ZfuvpZ+fgAm6qT95DFEDXGfJ3lSM37udINhXSI/IsBvW Z8urRpw7AWj/y7ABEgAvjTPPVg== X-Google-Smtp-Source: ABdhPJxLHM0lzwc//56xGAcFucAqUl4YPJ5KF54JOwq+cS0oQFQF0p52S3RgUWHt79xj+PKP0ZRRmQ== X-Received: by 2002:adf:e60e:: with SMTP id p14mr1085379wrm.188.1605206468284; Thu, 12 Nov 2020 10:41:08 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id j127sm8221850wma.31.2020.11.12.10.41.06 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Nov 2020 10:41:07 -0800 (PST) From: Georgi Djakov To: akpm@linux-foundation.org, linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, sudaraja@codeaurora.org, pratikp@codeaurora.org, lmark@codeaurora.org, Georgi Djakov Subject: [PATCH] mm/page_owner: Record timestamp and pid Date: Thu, 12 Nov 2020 20:41:06 +0200 Message-Id: <20201112184106.733-1-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 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: From: Liam Mark Collect the time for each allocation recorded in page owner so that allocation "surges" can be measured. Record the pid for each allocation recorded in page owner so that the source of allocation "surges" can be better identified. Signed-off-by: Liam Mark Signed-off-by: Georgi Djakov --- mm/page_owner.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/mm/page_owner.c b/mm/page_owner.c index b735a8eafcdb..e6dc52db5ba5 100644 --- a/mm/page_owner.c +++ b/mm/page_owner.c @@ -10,6 +10,7 @@ #include #include #include +#include #include "internal.h" @@ -25,6 +26,8 @@ struct page_owner { gfp_t gfp_mask; depot_stack_handle_t handle; depot_stack_handle_t free_handle; + u64 ts_nsec; + int pid; }; static bool page_owner_enabled = false; @@ -172,6 +175,8 @@ static inline void __set_page_owner_handle(struct page *page, page_owner->order = order; page_owner->gfp_mask = gfp_mask; page_owner->last_migrate_reason = -1; + page_owner->pid = current->pid; + page_owner->ts_nsec = local_clock(); __set_bit(PAGE_EXT_OWNER, &page_ext->flags); __set_bit(PAGE_EXT_OWNER_ALLOCATED, &page_ext->flags); @@ -236,6 +241,8 @@ void __copy_page_owner(struct page *oldpage, struct page *newpage) new_page_owner->last_migrate_reason = old_page_owner->last_migrate_reason; new_page_owner->handle = old_page_owner->handle; + new_page_owner->pid = old_page_owner->pid; + new_page_owner->ts_nsec = old_page_owner->ts_nsec; /* * We don't clear the bit on the oldpage as it's going to be freed @@ -349,9 +356,10 @@ print_page_owner(char __user *buf, size_t count, unsigned long pfn, return -ENOMEM; ret = snprintf(kbuf, count, - "Page allocated via order %u, mask %#x(%pGg)\n", + "Page allocated via order %u, mask %#x(%pGg), pid %d, ts %llu ns\n", page_owner->order, page_owner->gfp_mask, - &page_owner->gfp_mask); + &page_owner->gfp_mask, page_owner->pid, + page_owner->ts_nsec); if (ret >= count) goto err;