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 X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, 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 303FBC433E2 for ; Tue, 15 Sep 2020 18:03:47 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 885D521974 for ; Tue, 15 Sep 2020 18:03:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="ApauS6QF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 885D521974 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amazon.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A979C900066; Tue, 15 Sep 2020 14:03:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A47A2900057; Tue, 15 Sep 2020 14:03:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 90F2A900066; Tue, 15 Sep 2020 14:03:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0135.hostedemail.com [216.40.44.135]) by kanga.kvack.org (Postfix) with ESMTP id 781C3900057 for ; Tue, 15 Sep 2020 14:03:45 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 2751A180AD807 for ; Tue, 15 Sep 2020 18:03:45 +0000 (UTC) X-FDA: 77266068810.08.cub13_5c099e027113 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin08.hostedemail.com (Postfix) with ESMTP id 3AEC21819E62E for ; Tue, 15 Sep 2020 18:03:43 +0000 (UTC) X-HE-Tag: cub13_5c099e027113 X-Filterd-Recvd-Size: 4711 Received: from smtp-fw-6002.amazon.com (smtp-fw-6002.amazon.com [52.95.49.90]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Tue, 15 Sep 2020 18:03:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1600193022; x=1631729022; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=rU/hvNQ4KOXq6vAima+hbiKNVR2CLXhJJ3q5+iUMNvE=; b=ApauS6QFWFnVhnmTv0FpY2MPm4h0/CzZA21d0X0GJbq+vtx2dn8vr2XS 0kyO+ALiuJ6S6mFwGuMVtGTmQ2Mdm4xJE6imc92Jvu2xJa9j1QEUNBSVa CwUjJGh/3mJtUzmvcpAgsSDz/XJpuo2vEqDvjkmmRzCG8o74//eUkSXUF I=; X-IronPort-AV: E=Sophos;i="5.76,430,1592870400"; d="scan'208";a="54124498" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-1a-7d76a15f.us-east-1.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-6002.iad6.amazon.com with ESMTP; 15 Sep 2020 18:03:32 +0000 Received: from EX13D31EUA004.ant.amazon.com (iad12-ws-svc-p26-lb9-vlan3.iad.amazon.com [10.40.163.38]) by email-inbound-relay-1a-7d76a15f.us-east-1.amazon.com (Postfix) with ESMTPS id B0500A2159; Tue, 15 Sep 2020 18:03:20 +0000 (UTC) Received: from u3f2cd687b01c55.ant.amazon.com (10.43.161.34) by EX13D31EUA004.ant.amazon.com (10.43.165.161) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 15 Sep 2020 18:03:00 +0000 From: SeongJae Park To: CC: SeongJae Park , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [RFC PATCH 1/2] mm/damon: Put more information in kdamond thread name Date: Tue, 15 Sep 2020 20:02:23 +0200 Message-ID: <20200915180225.17439-2-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200915180225.17439-1-sjpark@amazon.com> References: <20200915180225.17439-1-sjpark@amazon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.161.34] X-ClientProxiedBy: EX13D06UWC004.ant.amazon.com (10.43.162.97) To EX13D31EUA004.ant.amazon.com (10.43.165.161) X-Rspamd-Queue-Id: 3AEC21819E62E X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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: SeongJae Park While multiple kdamond threads can run, it is hard to distinguish each thread as all kdamond threads has same name, 'kdamond'. This commit puts more information including if it is spawned from the user context (via the debugfs interface) and for what context it is running. The format of the name is: kdamond..<# of context> If it is not spawned from the user context, becomes 0. Using this information, for example, the user space could easily account CPU usage of DAMON that they requested in fine granularity. Signed-off-by: SeongJae Park --- mm/damon.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mm/damon.c b/mm/damon.c index c92e4c76aa53..abb8c07a4c7d 100644 --- a/mm/damon.c +++ b/mm/damon.c @@ -1552,6 +1552,8 @@ static bool damon_kdamond_running(struct damon_ctx *ctx) * __damon_start() - Starts monitoring with given context. * @ctx: monitoring context * + * This function should be called while damon_lock is hold. + * * Return: 0 on success, negative error code otherwise. */ static int __damon_start(struct damon_ctx *ctx) @@ -1562,7 +1564,8 @@ static int __damon_start(struct damon_ctx *ctx) if (!ctx->kdamond) { err = 0; ctx->kdamond_stop = false; - ctx->kdamond = kthread_create(kdamond_fn, ctx, "kdamond"); + ctx->kdamond = kthread_create(kdamond_fn, ctx, "kdamond.%d.%d", + current ? current->pid : 0, nr_running_ctxs); if (IS_ERR(ctx->kdamond)) err = PTR_ERR(ctx->kdamond); else -- 2.17.1