From patchwork Fri Sep 24 22:43:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12516967 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12E49C433FE for ; Fri, 24 Sep 2021 22:43:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BDB2C61250 for ; Fri, 24 Sep 2021 22:43:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BDB2C61250 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 6159D6B007E; Fri, 24 Sep 2021 18:43:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5C54A6B0080; Fri, 24 Sep 2021 18:43:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 48D7E900002; Fri, 24 Sep 2021 18:43:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0164.hostedemail.com [216.40.44.164]) by kanga.kvack.org (Postfix) with ESMTP id 349756B007E for ; Fri, 24 Sep 2021 18:43:43 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 0090B181CCCB7 for ; Fri, 24 Sep 2021 22:43:42 +0000 (UTC) X-FDA: 78623945526.12.6E8C49D Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf15.hostedemail.com (Postfix) with ESMTP id B0FB2D000096 for ; Fri, 24 Sep 2021 22:43:42 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id CF1F861019; Fri, 24 Sep 2021 22:43:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1632523422; bh=RpB1DxDYaXU7/JZEGKGoFaw9n+Fbb+USJOf6il0Qr3A=; h=Date:From:To:Subject:In-Reply-To:From; b=xHMBBpXFLY7xyMFj5OiyOT6E6MbSzUxi6ijCNzbQD4PTCZDG6A2PGMpRETM8hhN8t cNHiv1CY3O6HO7sQy2MBsvzqZV8s/dPFe4Ae7tf7NejI9GSPEgx+1c3H+Q5OW+Yj2A I7pv5ZvCnKTG9f8s1X6k7fSFv+l442x5XFvXOKDU= Date: Fri, 24 Sep 2021 15:43:41 -0700 From: Andrew Morton To: akpm@linux-foundation.org, changbin.du@gmail.com, linux-mm@kvack.org, mm-commits@vger.kernel.org, torvalds@linux-foundation.org Subject: [patch 08/16] tools/vm/page-types: remove dependency on opt_file for idle page tracking Message-ID: <20210924224341.cP9xYOrED%akpm@linux-foundation.org> In-Reply-To: <20210924154257.1dbf6699ab8d88c0460f924f@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: B0FB2D000096 X-Stat-Signature: 53h3gajm87sdm6sawctze6xd4yzq3hau Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=xHMBBpXF; spf=pass (imf15.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-HE-Tag: 1632523422-717060 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: Changbin Du Subject: tools/vm/page-types: remove dependency on opt_file for idle page tracking Idle page tracking can also be used for process address space, not only file mappings. Without this change, using with '-i' option for process address space encounters below errors reported. $ sudo ./page-types -p $(pidof bash) -i mark page idle: Bad file descriptor mark page idle: Bad file descriptor mark page idle: Bad file descriptor mark page idle: Bad file descriptor mark page idle: Bad file descriptor mark page idle: Bad file descriptor .... Link: https://lkml.kernel.org/r/20210917032826.10669-1-changbin.du@gmail.com Signed-off-by: Changbin Du Signed-off-by: Andrew Morton --- tools/vm/page-types.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/tools/vm/page-types.c~tools-vm-page-types-remove-dependency-on-opt_file-for-idle-page-tracking +++ a/tools/vm/page-types.c @@ -1331,7 +1331,7 @@ int main(int argc, char *argv[]) if (opt_list && opt_list_mapcnt) kpagecount_fd = checked_open(PROC_KPAGECOUNT, O_RDONLY); - if (opt_mark_idle && opt_file) + if (opt_mark_idle) page_idle_fd = checked_open(SYS_KERNEL_MM_PAGE_IDLE, O_RDWR); if (opt_list && opt_pid)