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=-7.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=no 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 75F8CC433E1 for ; Wed, 22 Jul 2020 10:37:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2ACC22065E for ; Wed, 22 Jul 2020 10:37:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="AKHegjcW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2ACC22065E 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 B8F936B0003; Wed, 22 Jul 2020 06:37:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B19276B0005; Wed, 22 Jul 2020 06:37:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9E0966B0006; Wed, 22 Jul 2020 06:37:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0022.hostedemail.com [216.40.44.22]) by kanga.kvack.org (Postfix) with ESMTP id 85EA16B0003 for ; Wed, 22 Jul 2020 06:37:28 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 337F11004C9C4 for ; Wed, 22 Jul 2020 10:37:28 +0000 (UTC) X-FDA: 77065360176.29.bread18_55135ac26f35 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin29.hostedemail.com (Postfix) with ESMTP id BE421181B7E1D for ; Wed, 22 Jul 2020 10:36:36 +0000 (UTC) X-HE-Tag: bread18_55135ac26f35 X-Filterd-Recvd-Size: 4431 Received: from smtp-fw-2101.amazon.com (smtp-fw-2101.amazon.com [72.21.196.25]) by imf09.hostedemail.com (Postfix) with ESMTP for ; Wed, 22 Jul 2020 10:36:36 +0000 (UTC) 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) X-Rspamd-Queue-Id: BE421181B7E1D X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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: 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