Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp7591300rwn; Wed, 14 Sep 2022 00:51:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR7alFVn3vkpV1OIJxeBqNJBQ8juS3SMBueR/yBI52DmXBcKewdQZwjt9kquXXPQeYo7md9J X-Received: by 2002:aa7:90d4:0:b0:544:9a9c:f563 with SMTP id k20-20020aa790d4000000b005449a9cf563mr11569236pfk.70.1663141902145; Wed, 14 Sep 2022 00:51:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663141902; cv=none; d=google.com; s=arc-20160816; b=vrbOSJw/xzEYsjhdweQ0qacj8779dbDpkh996teEFTtiqn8O8hWMZzqh3kk+cScJX1 Sm8NyJ7cyis+9A/2biY1EKwMJ32rYqRCzoug419wHSnkMOQBpR8FOpWa8zmehwEj8uOg bBhiQ6497WQCxz3gmX8MZ94ot09kIfljKsyUy1K2nCBgv1B9t68BKYC6MHugjmvY/uGT dkWykLDjzuPUCBRnvuPeiHYWxTBGAB6+xhAAXnv58F0wgqpKBuKUxtfdTENEy2327rw1 piEdXfaPUJ25/NQZorWh/RavHIu4lwrMf4MonsMhUPVw8qq1VeSZiBNkqeywtJnUXK/B HVdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=sD+n0J554fgpLX+D3G6kFHVHbJxO75oIYJriGS78fuM=; b=DN4M/DOnNXfV+1lfg8HSEjjJaIE11JKJPmQZkYjvximdodpTkfJEVkyaAmG/nY7V0I JoN0j92jRiuey2NjRhbQCdzVgza3WPeABvEFTDOZOHAmFiIFOt755CTFAYpcWh3L4q6W SYjhbq+yZHs7Z9bablOxksjezdmRU4VemDsinzkLkVsXbu5BtwDe+hjK9KP0apOnOusw x7LQq8b0ukAh8LEZjtSxeZ6BLK7X6R2qrNvcZJMQBdFQVvR4210KSdyeuM+1Cx1iNV0m 8/w5zJq8WoTBWjJat/dIPfu17OVwbbeNVjj6S+nSplUUiztQszZ0AzmKVl62TKHj76E8 w8Eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=I5cEfBhZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q16-20020a63e950000000b0043961fac768si2413949pgj.497.2022.09.14.00.51.29; Wed, 14 Sep 2022 00:51:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=I5cEfBhZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229837AbiINHlN (ORCPT + 99 others); Wed, 14 Sep 2022 03:41:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229484AbiINHlL (ORCPT ); Wed, 14 Sep 2022 03:41:11 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB50972B53; Wed, 14 Sep 2022 00:41:09 -0700 (PDT) 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="278749620" X-IronPort-AV: E=Sophos;i="5.93,313,1654585200"; d="scan'208";a="278749620" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Sep 2022 00:41:09 -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 X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.