Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp401454ybh; Wed, 22 Jul 2020 03:37:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxor0JUzP3/F812XMKi0+IwJuasqDo0qt1/zl5rtrb3tZRGQu4iQErS6sThtdCFiqmQE6qP X-Received: by 2002:a17:906:328d:: with SMTP id 13mr29892983ejw.71.1595414244276; Wed, 22 Jul 2020 03:37:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595414244; cv=none; d=google.com; s=arc-20160816; b=HxpBtNKMh+3DxxTqCsdd4C6b4uA6cBc67FmQ1y0Cjj/XozgGqcQj3wB6fz5vAwSMS6 CcbS1s2/p3MLn0koTYVdj7o0EswdroCWu4YbUEcH+5rcuNR+H9fQNlbt7clvDhQLRism bq7AM43AognH692OMwOrXqYyMUmSgsqalLHZgAREbMAeiuB3+yGDaLchqM5BgNoPm6vm 9vkCHU0k6k9pGsyUhxNbfrIGJI6Pd75D2dpz84QWivC619J1Itpb3TzrRb99KQJxpL4z toFX7TIooKjm7fSq7wLaUTX2k9Y3n4NC+3IeFVNKOCJ6Dm+zI0nHy+R91nrHy6LOjyvF EwTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:in-reply-to:message-id:date :subject:cc:to:from:ironport-sdr:dkim-signature; bh=bAMQ4NIzCVkNjI66avrrcftODz28EEl2fZZx11uJRrg=; b=Wom39g/30vf/m+Qay1n/A36HQb5aLwvh5AS66fObeGt6+vVx65V+nWVuiOjT75rtEF Dqy7e1f9ar8GPGvLAh9NfXlLBFPd9cjq/ykSuQHCcjzyx0O+CPmeazU6sHcjRjO6xRJ2 OgrjZWWb8GK83dQ6X9Ga5rj+Sxe/cYPLvhhLgi4MAyxu/Bi4YaeaKAcliDJdKmJ4K2uf eEgXvIEqQtVATBsGpAaOEBAcjKcuYdwlVz09PEbNcS8uvLa0BBUJI7TdR/EX5dfihPKY MvRgrEBa4xUjzQB//3+z0WMbUTdBm1hnXIi3hXaf7ZhFWmBt89izfAb2jLF5UVueuPf7 LJrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=AKHegjcW; 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 bx21si12697986ejc.644.2020.07.22.03.37.01; Wed, 22 Jul 2020 03:37:24 -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=AKHegjcW; 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 S1730011AbgGVKgh (ORCPT + 99 others); Wed, 22 Jul 2020 06:36:37 -0400 Received: from smtp-fw-2101.amazon.com ([72.21.196.25]:38252 "EHLO smtp-fw-2101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726153AbgGVKgh (ORCPT ); Wed, 22 Jul 2020 06:36:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1595414197; x=1626950197; h=from:to:cc:subject:date:message-id:in-reply-to: mime-version; bh=bAMQ4NIzCVkNjI66avrrcftODz28EEl2fZZx11uJRrg=; b=AKHegjcWd2tagC45bh8teNkiFCmkU/Jklh+F1kZ4wfxczbn3pK/+ZV9x 4VCQ4+QMzU0NP4Mq+9ecgdOwbbUDW59kWVihiya1UP4lFbXFJ7gWNtfIE E4XORBc9+lGjCchfjnoAXqwG7qPstJRCVCfB8nD55NqffKfxBIVhHXt/f o=; IronPort-SDR: UXO/LAA2bMcCDj5NDYikzPWv5PIIT4wczcfQLp70E9yZ7hjXZWQzoyxbzXRw0yTIflT7zLu24o i2Q49bQoQtvQ== X-IronPort-AV: E=Sophos;i="5.75,381,1589241600"; d="scan'208";a="43322491" Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-1d-5dd976cd.us-east-1.amazon.com) ([10.43.8.2]) by smtp-border-fw-out-2101.iad2.amazon.com with ESMTP; 22 Jul 2020 10:36:36 +0000 Received: from EX13MTAUEA002.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan2.iad.amazon.com [10.40.159.162]) by email-inbound-relay-1d-5dd976cd.us-east-1.amazon.com (Postfix) with ESMTPS id 45136A394A; Wed, 22 Jul 2020 10:36:33 +0000 (UTC) Received: from EX13D31EUA004.ant.amazon.com (10.43.165.161) by EX13MTAUEA002.ant.amazon.com (10.43.61.77) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 22 Jul 2020 10:36:32 +0000 Received: from u886c93fd17d25d.ant.amazon.com (10.43.160.26) by EX13D31EUA004.ant.amazon.com (10.43.165.161) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 22 Jul 2020 10:36:17 +0000 From: SeongJae Park To: SeongJae Park CC: , SeongJae Park , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH v18 09/14] mm/damon: Implement a debugfs interface Date: Wed, 22 Jul 2020 12:36:01 +0200 Message-ID: <20200722103601.27454-1-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200713084144.4430-10-sjpark@amazon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.160.26] X-ClientProxiedBy: EX13D03UWA004.ant.amazon.com (10.43.160.250) 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 On Mon, 13 Jul 2020 10:41:39 +0200 SeongJae Park wrote: > From: SeongJae Park > > This commit implements a debugfs interface for DAMON. It works for the > virtual address spaces monitoring. > [...] > +/* > + * Converts a string into an array of unsigned long integers > + * > + * Returns an array of unsigned long integers if the conversion success, or > + * NULL otherwise. > + */ > +static int *str_to_pids(const char *str, ssize_t len, ssize_t *nr_pids) > +{ > + int *pids; > + const int max_nr_pids = 32; > + int pid; > + int pos = 0, parsed, ret; > + > + *nr_pids = 0; > + pids = kmalloc_array(max_nr_pids, sizeof(pid), GFP_KERNEL); > + if (!pids) > + return NULL; > + while (*nr_pids < max_nr_pids && pos < len) { > + ret = sscanf(&str[pos], "%d%n", &pid, &parsed); > + pos += parsed; > + if (ret != 1) > + break; > + pids[*nr_pids] = pid; > + *nr_pids += 1; > + } > + if (*nr_pids == 0) { > + kfree(pids); > + pids = NULL; > + } Hmm, this means debugfs users cannot make 'target_ids' empty again. I will fix this in the next spin. Thanks, SeongJae Park