From patchwork Mon Jul 23 11:19:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlastimil Babka X-Patchwork-Id: 10539997 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 379DE1805 for ; Mon, 23 Jul 2018 11:19:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2714328600 for ; Mon, 23 Jul 2018 11:19:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1BA3A28609; Mon, 23 Jul 2018 11:19:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B44E928600 for ; Mon, 23 Jul 2018 11:19:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7500E6B000A; Mon, 23 Jul 2018 07:19:53 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 65D526B0007; Mon, 23 Jul 2018 07:19:53 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4FC266B0010; Mon, 23 Jul 2018 07:19:53 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by kanga.kvack.org (Postfix) with ESMTP id ED13E6B0007 for ; Mon, 23 Jul 2018 07:19:52 -0400 (EDT) Received: by mail-pg1-f197.google.com with SMTP id g5-v6so138332pgv.12 for ; Mon, 23 Jul 2018 04:19:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id; bh=kZu6K+l0OphIuwsu2mQQECjXIyOZ09nc11ouso3Sclk=; b=KiX3GcWYKtAfQ8POvm5zNLFtLYiYq6XRd+fOiIggQ6k55dEJXIbbBr+mCI2HQ5/0Cy nyoR4u8sR3Kkz9DOiK9fSdXpJCrrP8hzc/RIRUSnkNhfrJK176CjHwMIdlGbtti4W8bN f8EThqbg+S4w0elCQCvCJiL0f+015eHZfn5LxRv5lKx7KlNcILgbIi7vsE73hl0XoRI5 b3GVCo1DDh/MUc6yQVkWV/U3nnU5GbldsVsv+KtIWrRvYoWzWtCDuYE8EVBIucgm8L/1 jyjPvBa7u7p62YgS4T9iLTnv+KEahks5SbAzpHxV7rYUTbtcDsnEqJ6CDFdeTiN6Phfd rPPw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of vbabka@suse.cz designates 195.135.220.15 as permitted sender) smtp.mailfrom=vbabka@suse.cz X-Gm-Message-State: AOUpUlFN4xjWx12JvaVh7wV0nJzbpYljR+YOMUh5RatnqsRzXftTEtAf xgDniPFsTcWW3aGMeeGC6N/EPwL39vn90i/jliIKvRWHIclSwolEVXRTAGprrgey/D98m1UZ+s9 3fe6r+wjRiL5V8AT/hBGAE1x3v+5NoPy1Nr0HP0HrU+3hHfNxS8yjQxltv2y+SSuEXw== X-Received: by 2002:a17:902:1005:: with SMTP id b5-v6mr12646918pla.207.1532344792615; Mon, 23 Jul 2018 04:19:52 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfJjAgFjwbH4qVe34he/xFsCAQpDLzl4mhpd3aDXislQQRk2ewRcxBbJSJ5ywBBr/EObmQw X-Received: by 2002:a17:902:1005:: with SMTP id b5-v6mr12646874pla.207.1532344791715; Mon, 23 Jul 2018 04:19:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532344791; cv=none; d=google.com; s=arc-20160816; b=LPyiBwFMbh3H05NlQwrMG3lcelfBu7Gvo+eOL69vOpoMB2clbCEikbpv5kgmDE5g6Z WIi85rUpVUIOVluRJ7kKZdAl2XLZN1MjB54J3L050Ujl++ca2Q4hez3X8a8EoiugXSvm /14geCTJ2pl7s30fe8IGCgwsggMczAg2dqXRu7hQwuiZXYeoej/+0JTlcnDJVbvZyFxC vL6hLWJAZFfrxks6KFlB1Tl8Ii1fheEdU6mivWOwmod05aZEWOLiKM2geprpjJKfNGQc H5DbqxA9vMV+5LLeoK4FAN7XezlsGAnfp42BaEQxvr9VZ4wKtrRPL6TG4eZGc3Mrc1mD RdZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:arc-authentication-results; bh=kZu6K+l0OphIuwsu2mQQECjXIyOZ09nc11ouso3Sclk=; b=DFAndVKFEcqDmY4tnw5rzPyfPCD5uEqtWTBa9aFDapcEbF5tG4tQObHn7Hpf/BXsDz Mg7f76WyP1P3UEiG74Pr6VTDEESdhPZUP1cUMi8KMb4ueogcEbNWHvtVxY8ZW8Utk/RZ zYXSlossbipRxzGs8If6mqm95TP16oAU50NJ+bOL6+veTx8N95Uk8lMqBLfrawJxwv1B TasCLE1Le23RIym07fC1zICgPNi4p3H5Boe9Epu0nGOOlOr2FbPYiA8hd6Jg+v7fiOI3 NRlPfqDV/KCJJjqz4qX6Sd+KFmbpt+Kw+ths+kYq8QD8SZnnfIGv1Xs0BPTCvlAG855f Jvyg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of vbabka@suse.cz designates 195.135.220.15 as permitted sender) smtp.mailfrom=vbabka@suse.cz Received: from mx1.suse.de (mx2.suse.de. [195.135.220.15]) by mx.google.com with ESMTPS id h126-v6si7681354pgc.429.2018.07.23.04.19.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Jul 2018 04:19:51 -0700 (PDT) Received-SPF: pass (google.com: domain of vbabka@suse.cz designates 195.135.220.15 as permitted sender) client-ip=195.135.220.15; Authentication-Results: mx.google.com; spf=pass (google.com: domain of vbabka@suse.cz designates 195.135.220.15 as permitted sender) smtp.mailfrom=vbabka@suse.cz X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id C10B4AEB1; Mon, 23 Jul 2018 11:19:49 +0000 (UTC) From: Vlastimil Babka To: Andrew Morton Cc: Daniel Colascione , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Alexey Dobriyan , linux-api@vger.kernel.org, Vlastimil Babka Subject: [PATCH 0/4] cleanups and refactor of /proc/pid/smaps* Date: Mon, 23 Jul 2018 13:19:29 +0200 Message-Id: <20180723111933.15443-1-vbabka@suse.cz> X-Mailer: git-send-email 2.18.0 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: X-Virus-Scanned: ClamAV using ClamSMTP The recent regression in /proc/pid/smaps made me look more into the code. Especially the issues with smaps_rollup reported in [1] as explained in Patch 4, which fixes them by refactoring the code. Patches 2 and 3 are preparations for that. Patch 1 is me realizing that there's a lot of boilerplate left from times where we tried (unsuccessfuly) to mark thread stacks in the output. Originally I had also plans to rework the translation from /proc/pid/*maps* file offsets to the internal structures. Now the offset means "vma number", which is not really stable (vma's can come and go between read() calls) and there's an extra caching of last vma's address. My idea was that offsets would be interpreted directly as addresses, which would also allow meaningful seeks (see the ugly seek_to_smaps_entry() in tools/testing/selftests/vm/mlock2.h). However loff_t is (signed) long long so that might be insufficient somewhere for the unsigned long addresses. So the result is fixed issues with skewed /proc/pid/smaps_rollup results, simpler smaps code, and a lot of unused code removed. [1] https://marc.info/?l=linux-mm&m=151927723128134&w=2 Vlastimil Babka (4): mm: /proc/pid/*maps remove is_pid and related wrappers mm: proc/pid/smaps: factor out mem stats gathering mm: proc/pid/smaps: factor out common stats printing mm: proc/pid/smaps_rollup: convert to single value seq_file fs/proc/base.c | 6 +- fs/proc/internal.h | 3 - fs/proc/task_mmu.c | 294 +++++++++++++++++++------------------------ fs/proc/task_nommu.c | 39 +----- 4 files changed, 133 insertions(+), 209 deletions(-)