Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3144144pxk; Tue, 15 Sep 2020 11:08:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzH7yeHRyl5tupA2gjbB8vR31uu1PSMFWlN6gczp8qPibidYmEd5V2hvmC1VJqJcYj7R4tE X-Received: by 2002:a50:d4ce:: with SMTP id e14mr24462491edj.126.1600193292861; Tue, 15 Sep 2020 11:08:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600193292; cv=none; d=google.com; s=arc-20160816; b=qLamQg9eRR/nN6V5XLB2nTZmaVtxbS2HvN3JQnxjMdpXYjmZY8V3jM87cFrAhJBNOJ Nz6RF+DYk45/1pDbg+lNACneFU0+yP7Jn6cpfJgAfU8ygvs6ROmCVGkndsSEfc+AcivK w+7ojlCE34ukHhoLraraeL8MKbq7Xf62+T/XOoMruu9TCpUFMoj2eL5FDbd+3qv0HBew 3F7fc6mkOVmNPV9LKQ/VcnbNp8TX0eBRQ1wseV8D+wHgjqpjZns4gmawk4naWSXAxRBw B0hqV6PLab+QcoMyrwfF7MMp/COxIGdO7zLmGvXZ8Hxoy9TWQEFCyrrOzw4XzBLwu0Ch SWzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=rU/hvNQ4KOXq6vAima+hbiKNVR2CLXhJJ3q5+iUMNvE=; b=QVz8RlA9l9XRNsNQtRf6UwCfvjIIknLdCD2J0Lr44dDHczGEQVC3EHwkbCWSzFRVa4 02Py4YbW1rf0/Y5hFDPmT+WxwUj/KFltLiJo5CTzdwrwOrNvKwGn8zdo/TdBfeLHtzUn /1dB9HNOGQ/NCXvUXQpUCHUfR3hAj2+XXimuD99p8jj8jfyO4Pj0w8uhrrf5X+dvYRsY 1+fNLB76TBrldPB1VgG8LaqWQZtksPkpsBZ+YSWv3hwfwx+mMmnCQaeD/28Ih/PX0e7H IqAqau3LUGxSz5oBghK4ZfCm7EGIAttgHduxhiRgYyRglveLPtxC03kxSftD+B1ok76P 3oXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=ApauS6QF; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jz7si2420113ejb.726.2020.09.15.11.07.49; Tue, 15 Sep 2020 11:08:12 -0700 (PDT) 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; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=ApauS6QF; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727901AbgIOSHD (ORCPT + 99 others); Tue, 15 Sep 2020 14:07:03 -0400 Received: from smtp-fw-6002.amazon.com ([52.95.49.90]:26906 "EHLO smtp-fw-6002.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727631AbgIOSDn (ORCPT ); Tue, 15 Sep 2020 14:03:43 -0400 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) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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