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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A5EEECAAD3 for ; Wed, 14 Sep 2022 07:41:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 81F458D0001; Wed, 14 Sep 2022 03:41:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7A8246B0073; Wed, 14 Sep 2022 03:41:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 670098D0001; Wed, 14 Sep 2022 03:41:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 49CCC6B0071 for ; Wed, 14 Sep 2022 03:41:10 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 205361A021A for ; Wed, 14 Sep 2022 07:41:10 +0000 (UTC) X-FDA: 79909895100.21.CC45840 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by imf12.hostedemail.com (Postfix) with ESMTP id E78A9400BE for ; Wed, 14 Sep 2022 07:41:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663141269; x=1694677269; h=message-id:date:mime-version:subject:to:references:from: in-reply-to:content-transfer-encoding; bh=5rRWCvywlUXdhqWUteBuY+K68wd0DLGVaPN2d1JfXdw=; b=I5cEfBhZd/yDrhA5KM3MAkpSq2FJSEBEt3jX64Y4axWju5ApT+r0zkjR C3EV9qEYcWAhy3DjufuvX/+pk3Rdajg8yIFCZO6/6DbCJYN7w1nGRxR/B 5MQs+VBAVrP3I6JUVDfzmRGC8H68hkizF764eyvjsRztDJ4aonD9DRnmV THl+jyGYL0dGipKldkJTeGuoQQ36LiU+ur6ZlGDjawXCuSrTevzZh555/ ZHDtD33XepYlH3NndcAIV03T9MzxJuTIi6q0rMHKLxv6dZAU8DNZ3FpG0 OLTeLnz10DBhZHEEKIyoHe8DyrhLueS/RoFp5dBsN62KMWJXuMLJaQrTB g==; X-IronPort-AV: E=McAfee;i="6500,9779,10469"; a="299175604" X-IronPort-AV: E=Sophos;i="5.93,313,1654585200"; d="scan'208";a="299175604" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Sep 2022 00:41:06 -0700 X-IronPort-AV: E=Sophos;i="5.93,313,1654585200"; d="scan'208";a="647283158" Received: from debbiedx-mobl.ger.corp.intel.com (HELO [10.213.238.97]) ([10.213.238.97]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Sep 2022 00:40:57 -0700 Message-ID: Date: Wed, 14 Sep 2022 00:40:55 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [RFC 1/1] mm: Add per-task struct tlb counters Content-Language: en-US To: Joe Damato , x86@kernel.org, linux-mm@kvack.org, Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org References: <1663120270-2673-1-git-send-email-jdamato@fastly.com> <1663120270-2673-2-git-send-email-jdamato@fastly.com> From: Dave Hansen In-Reply-To: <1663120270-2673-2-git-send-email-jdamato@fastly.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663141269; a=rsa-sha256; cv=none; b=Rxw65kmvvyqD39TKu0um1xOm2G0DjZOS+VOYghfABvS3mkqkj9/LYPHMOidcjoImsFzEz+ yrI3UwZmVTc8oPsN4ClYFFnRiYLpNtOdx8h1TsWlL1GKh80zCe1Oav2JgHXYP4oHz4mIfL V7m07RJnK+eC1XnEvdRIB2wcTZyunrM= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=I5cEfBhZ; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf12.hostedemail.com: domain of dave.hansen@intel.com designates 134.134.136.24 as permitted sender) smtp.mailfrom=dave.hansen@intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663141269; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=sD+n0J554fgpLX+D3G6kFHVHbJxO75oIYJriGS78fuM=; b=05CopppES/oS/YXlXNzVxZ5eQbCRo3AdR/njD5PDTUM10vjPRpqtwng0JOf+/UgXrhvF6/ EL8uGniK1PEbm4F4bXGOF75UdyfhVMvOgCOxNJOY6xlT4BvsRxVeAvy5Lo8q2QUBz6FAPd aBd0RT6x0WgvkQgr4l8W6IWoJpZQRgY= X-Stat-Signature: 1bo34zy68waguo6s566m45us7ck9eoju X-Rspamd-Queue-Id: E78A9400BE X-Rspamd-Server: rspam03 X-Rspam-User: Authentication-Results: imf12.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=I5cEfBhZ; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf12.hostedemail.com: domain of dave.hansen@intel.com designates 134.134.136.24 as permitted sender) smtp.mailfrom=dave.hansen@intel.com X-HE-Tag: 1663141268-691754 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 9/13/22 18:51, Joe Damato wrote: > TLB shootdowns are tracked globally, but on a busy system it can be > difficult to disambiguate the source of TLB shootdowns. > > Add two counter fields: > - nrtlbflush: number of tlb flush events received > - ngtlbflush: number of tlb flush events generated > > Expose those fields in /proc/[pid]/stat so that they can be analyzed > alongside similar metrics (e.g. min_flt and maj_flt). On x86 at least, we already have two other ways to count flushes. You even quoted them with your patch: > count_vm_tlb_event(NR_TLB_REMOTE_FLUSH); > + current->ngtlbflush++; > if (info->end == TLB_FLUSH_ALL) > trace_tlb_flush(TLB_REMOTE_SEND_IPI, TLB_FLUSH_ALL); Granted, the count_vm_tlb...() one is debugging only. But, did you try to use those other mechanisms? For instance, could you patch count_vm_tlb_event()? Why didn't the tracepoints work for you? Can this be done in a more arch-generic way? It's a shame to unconditionally add counters to the task struct and only use them on x86. If someone wanted to generalize the x86 tracepoints, or make them available to other architectures, I think that would be fine even if they have to change a bit (queue the inevitable argument about tracepoint ABI). P.S. I'm not a fan of the structure member naming.