Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp3273580pxx; Mon, 2 Nov 2020 04:53:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJzQV6ROq7otMBgqsODA1Osx3Lf+KvhZZUuo/ubZvrGNLpw9X92jUL/UYtR3ENUYvr6mdzu/ X-Received: by 2002:a17:906:400f:: with SMTP id v15mr14864980ejj.378.1604321619085; Mon, 02 Nov 2020 04:53:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604321619; cv=none; d=google.com; s=arc-20160816; b=TMvn75pOt0ApmCM/R90oy8JnLTkejX7chubj7tQIVT1TF3mqmcac2veYdhwqFHwxTQ ujZyQ1t40XuWU7d2WrVGgeu65ixVloUtuELYKBSKodYE4UC9U8fpLeDHAxzWLE42w9Pg Lo8sTlMgGFXLwNt/I/zyR9dOGwKcxTv53hBYn6wm2LThIFZl3KwuMCgTEZjMA/JXSAQb xHdyR7WjemUVovDA2nefx1AY29osLqwldq9TACLqCV9SGvUrk+/RLyKpwx/IgHoKP3QD DnWxNd2q02nqnAK1nxjDzDIzd/mDkcmR2wFIrOxwZdS7agxmSnDKUcCCWicwEV2mLNn8 0vDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=IJ3klNupDiFJIuHIo7uc+Py7oIQBbdT+C248Bvuo+Ks=; b=Wtpo0mvS20h6FgB8bmDHWK3md6dV1HusaQm//aaRG84NinwOs0NXOjqkroMp6w1Ga3 86D/0TfkLSe3bo14JVxEJhxTjYGnvsH/qi4gk+q8fJGK6SCMqdhwfJbj0tjI1RpMVIxQ KJ7H85XfKcC69mnzTmrClQPb67bPlkRLGH+dnNGYpQOMc5qEuDqnZtAlEUCfMHP4Xdpw 5Xjg0kalurpsTR+3TXtBiDfaaIkvURlUhTH4kj2Cadii5v9gLb/nkgfTDXfDGmF3fWBp 7mhwkxRWYp1B3J/m1+XpMTiSqIWcrWABbZA7qFwtOoExeLp0jQBMBRbsbA0NpAP/Xp0r zWKA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j10si11635145ejs.577.2020.11.02.04.53.16; Mon, 02 Nov 2020 04:53:39 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728852AbgKBMtQ (ORCPT + 99 others); Mon, 2 Nov 2020 07:49:16 -0500 Received: from mx2.suse.de ([195.135.220.15]:42488 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728842AbgKBMtQ (ORCPT ); Mon, 2 Nov 2020 07:49:16 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C7BDFAD5C; Mon, 2 Nov 2020 12:49:14 +0000 (UTC) Subject: Re: [PATCH v5 1/1] mmap_lock: add tracepoints around lock acquisition To: Axel Rasmussen , Steven Rostedt , Ingo Molnar , Andrew Morton , Michel Lespinasse , Daniel Jordan , Jann Horn , Chinwen Chang , Davidlohr Bueso , David Rientjes , Laurent Dufour Cc: Yafang Shao , linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20201027230711.2180435-1-axelrasmussen@google.com> <20201027230711.2180435-2-axelrasmussen@google.com> From: Vlastimil Babka Message-ID: <1ce6927b-32a6-b59f-7b6b-6474000f44db@suse.cz> Date: Mon, 2 Nov 2020 13:49:14 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201027230711.2180435-2-axelrasmussen@google.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/28/20 12:07 AM, Axel Rasmussen wrote: > The goal of these tracepoints is to be able to debug lock contention > issues. This lock is acquired on most (all?) mmap / munmap / page fault > operations, so a multi-threaded process which does a lot of these can > experience significant contention. > > We trace just before we start acquisition, when the acquisition returns > (whether it succeeded or not), and when the lock is released (or > downgraded). The events are broken out by lock type (read / write). > > The events are also broken out by memcg path. For container-based > workloads, users often think of several processes in a memcg as a single > logical "task", so collecting statistics at this level is useful. > > The end goal is to get latency information. This isn't directly included > in the trace events. Instead, users are expected to compute the time > between "start locking" and "acquire returned", using e.g. synthetic > events or BPF. The benefit we get from this is simpler code. > > Because we use tracepoint_enabled() to decide whether or not to trace, > this patch has effectively no overhead unless tracepoints are enabled at > runtime. If tracepoints are enabled, there is a performance impact, but > how much depends on exactly what e.g. the BPF program does. > > [ rostedt@goodmis.org: in-depth examples of tracepoint_enabled() usage, > and per-cpu-per-context buffer design ] Great, thanks Steven. > Signed-off-by: Axel Rasmussen Acked-by: Vlastimil Babka