Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4229039ybe; Mon, 9 Sep 2019 06:19:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqyRw5BiRXfIqQsaYR6auLHbwOBHb95c5G0/QLiLheACRgLn78bnJBodoGeV0PX2Wpgg/gZL X-Received: by 2002:a17:907:111b:: with SMTP id qu27mr19671302ejb.10.1568035181083; Mon, 09 Sep 2019 06:19:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568035181; cv=none; d=google.com; s=arc-20160816; b=zzTjEkhYo4f5lz8yWAgdgaoB1HrhfiZgKuS40XINndslhcskWdr5mOweleArNZz+iC y5RLxXzkoJfUhqKLoCK4JSchiqsLLsjp/tlvYYX2lAglPdxsitWOfGTZ1r6JpppkHeYE JOX/noZx1/dl0JyP+6BsDg/5kiDFgYbWC0z6NJADolOigxAtXMnPuBLU4k496JHuV867 2OAh2d+Bs1xtIUE4p+BAc6yPxmKqQc9XqVRosvTvm7CurPQbwIU7QV5YDQ4IgGtttQEr JzMhLJTJdgrgyNTcvpciJeQL/bosGyLxrV/Uf9LFc1W0a1nVXX26XYcfBU4VCPDQU65b /gNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=VCEjeAlF/R9OaASshTLZCJrV+Bz/CgD5dTbWg84yOkw=; b=C7vt8wOBLpacJGQWXbby30xfDBQx8Iy7ZqCT3+zsAGEkT2+CFYDmMqlWDzFs5ZnL8H lV7MBNrvG1x56TeedD+gZ9U6Qe6FG9IY6QV0DrKDLuehdGp9xOEFVwHbW6pMyrzxkmdU +2kIoKGLfWF+hCyzYUy7MltEGhJ7srYmUEl0zU3LhJLoZM990iidqvVdimA0pylsf+nZ 25eD0/XeFqiFEgjNO891RbdPVjKROe9d+TRo7XNRUZuQVntZzJ/SLKLXZ+FcPxGlWIzM g/vRmLFPqadjc8VjyHQ963ka7YgN/X97kQe59eSyVaUIEyQ1aOma9j/79wKVaWmAnZJw FAZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="s/5cez3J"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n3si7521388ejx.53.2019.09.09.06.19.16; Mon, 09 Sep 2019 06:19:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="s/5cez3J"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730249AbfIHRFJ (ORCPT + 99 others); Sun, 8 Sep 2019 13:05:09 -0400 Received: from mail-qt1-f193.google.com ([209.85.160.193]:47049 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729734AbfIHRFJ (ORCPT ); Sun, 8 Sep 2019 13:05:09 -0400 Received: by mail-qt1-f193.google.com with SMTP id v11so13195921qto.13 for ; Sun, 08 Sep 2019 10:05:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=VCEjeAlF/R9OaASshTLZCJrV+Bz/CgD5dTbWg84yOkw=; b=s/5cez3JbjZidvVcC7Ce82LxJWpWG8js/u//v7iCPLDCLbT++KsCJl/XA6IL28o8/g Tv754QWlrlpFqzqE0NGL/2qOzLIxsLK+SptB+S8Zl2dNq0gCuI25+oxBsAek4QnbuMEV NKjH9xJMaSF00fZ/hGdWidi7dh4+R/fsXOF3SYe7TDD8Lnoi4Xlc8iMausuXUAFhqwn7 1lNsd73RKCnZF4sMh1Uc/5bHTeeN4hAw9UMF/VtXaO9DLNc0BtVfMTmKglDGHrY+iULW vYyFmzw7on0t03WGVztnSTA6WYJ+jgXbKmaaD7R8y+HlGYrZAgCylVk3XUHWyZ3aa8fj dYxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=VCEjeAlF/R9OaASshTLZCJrV+Bz/CgD5dTbWg84yOkw=; b=bzp0EAYcZJGD1VGdQUE3V588E/0P3wD+39zD4VAJO2TTeSHq51TphNZ6/BwaLXvUpA 13A5Ov516IG3qxHNijCZPc5rNMQvo2IVugAVHmjzvuNOxWTDaEJPQBVYLtTDdrIidxzU LzkYIKfbdp17pupWBNgny6B9QOUGsToqBmwwfQtY/pfhkyrepw5/K6REGzCxaS0FurT5 91kcTecFkmxhojZcAMZOBdaFRXSSKDN/dIVeOviuxEzPsFOLzv0Hch4K1NxumzdRkEf8 ysnG8neF4XUrgQQwe8rHjl+2M+tkfZLWCcwOnd1iWzLBWCMfgNKhfAeluQ6v8f3Y951B gNgA== X-Gm-Message-State: APjAAAUX6RTAxvP/+anz3ZlHzAFh/ciR43shWNQA0fwL5H+PWtNlBELB MfhYXRt5VTXn9UNOWHM+U4PBTtY= X-Received: by 2002:a0c:d084:: with SMTP id z4mr11810376qvg.63.1567962308181; Sun, 08 Sep 2019 10:05:08 -0700 (PDT) Received: from [192.168.1.99] ([92.117.170.41]) by smtp.googlemail.com with ESMTPSA id w73sm3310832qkb.111.2019.09.08.10.05.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Sep 2019 10:05:07 -0700 (PDT) Subject: Re: [PATCH v6 1/4] ftrace: Implement fs notification for tracing_max_latency To: Joel Fernandes Cc: Steven Rostedt , Ingo Molnar , linux-kernel@vger.kernel.org References: <20190905132548.5116-1-viktor.rosendahl@gmail.com> <20190905132548.5116-2-viktor.rosendahl@gmail.com> <20190906141740.GA250796@google.com> <20190907233801.GA117656@google.com> From: Viktor Rosendahl Message-ID: <955add6c-1465-df65-ddb1-f2b3a05df9d1@gmail.com> Date: Sun, 8 Sep 2019 19:05:04 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190907233801.GA117656@google.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/8/19 1:38 AM, Joel Fernandes wrote:> On Sat, Sep 07, 2019 at 11:12:59PM +0200, Viktor Rosendahl wrote: >> On 9/6/19 4:17 PM, Joel Fernandes wrote: >>> On Thu, Sep 05, 2019 at 03:25:45PM +0200, Viktor Rosendahl wrote: >> >>>> + >>>> +__init static int latency_fsnotify_init(void) >>>> +{ >>>> + fsnotify_wq = alloc_workqueue("tr_max_lat_wq", >>>> + WQ_UNBOUND | WQ_HIGHPRI, 0); >>>> + if (!fsnotify_wq) { >>>> + pr_err("Unable to allocate tr_max_lat_wq\n"); >>>> + return -ENOMEM; >>>> + } >>> >>> Why not just use the system workqueue instead of adding another workqueue? >>> >> >> For the the latency-collector to work properly in the worst case, when a >> new latency occurs immediately, the fsnotify must be received in less >> time than what the threshold is set to. If we always are slower we will >> always lose certain latencies. >> >> My intention was to minimize latency in some important cases, so that >> user space receives the notification sooner rather than later. >> >> There doesn't seem to be any system workqueue with WQ_UNBOUND and >> WQ_HIGHPRI. My thinking was that WQ_UNBOUND might help with the latency >> in some important cases. >> >> If we use: >> >> queue_work(system_highpri_wq, &tr->fsnotify_work); >> >> then the work will (almost) always execute on the same CPU but if we are >> unlucky that CPU could be too busy while there could be another CPU in >> the system that would be able to process the work soon enough. >> >> queue_work_on() could be used to queue the work on another CPU but it >> seems difficult to select the right CPU. > > Ok, a separate WQ is fine with me as such since the preempt/irq events are on > a debug kernel anyway. Keep in mind that this feature is also enabled by the wakeup tracers and by hwlat. These are often enabled by production kernels. I guess it would be possible to add some ifdefs so that we create a new workqueue only if preempt/irqsoff tracing is enabled in the kernel config and use system_highpri_wq if we only have the wakeup and hwlat tracers in the config. However, I don't really like adding yet some more ifdefs to the code. Since a new workqueue will not necessariy create a new worker thread nowadays, I thought that it would be OK with a new unbound workqueue, which should not add much to the tendency to create more worker threads. > > I'll keep reviewing your patches next few days, I am at the LPC conference so > might be a bit slow. Overall I think the series look like its maturing and > getting close. > Ok, thanks. Could you let me know when you have looked through it all so that I know when it makes sense to make another reroll of the series? best regards, Viktor