Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9565001pxu; Mon, 28 Dec 2020 21:37:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJxQI/AMZDQxGAkRNJz6VkiUdPEfhbFUjFTLFVZveEROM/MjrShVHbYrKc2Sh7MT3rCjWF1Z X-Received: by 2002:a05:6402:1caa:: with SMTP id cz10mr45199397edb.345.1609220232854; Mon, 28 Dec 2020 21:37:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609220232; cv=none; d=google.com; s=arc-20160816; b=tFPY4WBzWTMtY+yMCDUf0coNe+AtwrJX6fUvjJ14wkAywHOqfLkSUDU6oeOgXEXIvi tUpQyUSdOkg4QDQZfpwkVoi3n/E68xiH0idCZACU+SBkqPu7LVhbghjyJKts1eNONDCJ Pf6AckgPUcGJWjRvviFPZjSGFwuEr2CeU/Tj0wACI8XGgomVvNHtrBnlFe/4s0l4Hi9Y +5SZATw1G7GYV/WMe9xFOq1s1/djNa0NetuFe7uJNt32lshRCS05qkkr1w9fC/nY38V+ 6Vlo9fS8ZhpDO3ivHSr3kjf6TXrf4oOt/Upm9bsyB6IJCGvA7iu+/jcuo8tTLHh80gTJ q+Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=1z4WRccNqEHkXZrpqL5+EXbqA+bbffVV7Na33E5Nho4=; b=vRaMSRjJULEOVefhMO+WS7YGvRvtTTekrJn4dVglywdILfmH0qGiEXMNdhehBOyfjf pQ0lj45mdQBCNutI6n1+37tqxWPzDMU+g7nXN9vdamif32pN1NJdVC6enHPPHLX9Ptj9 fjweKRO8nZXwhdQ5TJCEsgLpLtqufcRIBkAPU5HR9mEP60BeORq7Cu65Ecf45xDoNi+y lNWzmnE20QLN1/2VGye4ovIQ8LCPyQqgugALPa912vUdk31lJ7nq49A/7Sz2lWgE3sBx IEqEzF3gSEaAmGcGFHZe/Uq8Rors4n6ApFZh0U8iqCbHcrDQPoRNT1PRgqQnlM88qbeF 9unQ== ARC-Authentication-Results: i=1; mx.google.com; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rh14si15447837ejb.210.2020.12.28.21.36.49; Mon, 28 Dec 2020 21:37:12 -0800 (PST) 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; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726156AbgL2FgA (ORCPT + 99 others); Tue, 29 Dec 2020 00:36:00 -0500 Received: from mail-qt1-f179.google.com ([209.85.160.179]:32997 "EHLO mail-qt1-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725967AbgL2FgA (ORCPT ); Tue, 29 Dec 2020 00:36:00 -0500 Received: by mail-qt1-f179.google.com with SMTP id c14so8379155qtn.0 for ; Mon, 28 Dec 2020 21:35:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1z4WRccNqEHkXZrpqL5+EXbqA+bbffVV7Na33E5Nho4=; b=Y6LQLcfzkMWCVpUnvsyGmbW/19rctXolkoa/X9IaiMDIEg1P8nGMRPfNAGkYcTecGK YlffSqlhV4PVFI6lN4dEsFxExDDJyLo1U36uDwuVvCUXTRn23j9b1dsxxYH7GgCJcdUG X2LfwXxShfXIG4NEtLZrSLKSPfuQYl/KRb2QjS1908PjVhUuOUc95UIYKJZ/d3pRV3AG pzFV2ZpJ4VDvQELlZw07iUvx2SbkDyisjaqsohN4qO3HSEzG7g+agNNs/DJorIEYr0RU ct2DEvjC54hUXS+aBPhKXm8b619QgKKDNw8jMMAenPgg7iZCnUnJRSAaelB0JXuI1ajU tw0g== X-Gm-Message-State: AOAM533i+1+wH1XPCzjwnGUteFkNjZIlAmLG5Hx62hwe0+QRX4Jn35b1 FHlu4YbkArStprKScdhPLG+UJR26oc4JNmi+l3k= X-Received: by 2002:ac8:5406:: with SMTP id b6mr47283129qtq.276.1609220119376; Mon, 28 Dec 2020 21:35:19 -0800 (PST) MIME-Version: 1.0 References: <20201221070029.1451176-1-namhyung@kernel.org> <20201221070029.1451176-3-namhyung@kernel.org> <20201228115006.GB450923@krava> In-Reply-To: <20201228115006.GB450923@krava> From: Namhyung Kim Date: Tue, 29 Dec 2020 14:35:07 +0900 Message-ID: Subject: Re: [PATCH 2/3] perf tools: Skip MMAP record synthesis for kernel threads To: Jiri Olsa Cc: Arnaldo Carvalho de Melo , Ingo Molnar , Peter Zijlstra , Mark Rutland , Alexander Shishkin , LKML , Stephane Eranian , Andi Kleen , Ian Rogers Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 28, 2020 at 8:50 PM Jiri Olsa wrote: > > On Mon, Dec 21, 2020 at 04:00:28PM +0900, Namhyung Kim wrote: > > To synthesize information to resolve sample IPs, it needs to scan task > > and mmap info from the /proc filesystem. For each process, it > > opens (and reads) status and maps file respectively. But as kernel > > threads don't have memory maps so we can skip the maps file. > > > > To find kernel threads, check "VmPeak:" line in /proc//status > > file. It's about the peak virtual memory usage so only user-level > > tasks have that. Also check "Threads:" line (which follows the VmPeak > > line whether or not it exists) to be sure it's read enough data - just > > in case of deeply nested pid namespaces or large number of > > supplementary groups are involved. > > how much does this save? for kernel threads the maps file is empty > and we just open the file and close > > also perhaps just stat(".....maps") and check the size would be easier? The numbers are in the cover letter and it's around 5% on an idle machine which has mostly kernel threads. I think most of the win came from this change. It's just to avoid those syscalls, so I wanted to use the available info in the status file. Thanks, Namhyung