Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp3885188ybe; Mon, 9 Sep 2019 00:13:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqzvhjCo9V6OLg706Dt66IH1bFbD9EFNKUaeMFsaV6iCqZGivUAdw8CQCPBIkfRI3K93YhS8 X-Received: by 2002:a50:918d:: with SMTP id g13mr22669182eda.64.1568013239195; Mon, 09 Sep 2019 00:13:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568013239; cv=none; d=google.com; s=arc-20160816; b=Q/nkc9x7frvat3bUM+cHSjGuxMn103IAfNsILi5RW+QMeFYb4GU6Sb/OjktdhmU/Pa uKkLA0Gm2UlYEfDWZEhseOt20AXgBj5UmlmicvLgZh9ndgaBsRaKPDJObz8LeE4qfTt+ 32leTyE1bh2mpNs8K3s+gWVjchQQLMVYKbOtbxfKZA27Jpb7AIAgyd8DznBXYe4ed/NY s8xxS7u70GvVS/iVPTiZkKuJcDIifMJAYp5qonTWaKiMkcJhoZtEqydaqIdlqT2POYsT H6w9363KnD/HHd5ZIrAg0LkPV4XW+Ia08DV9WbOkqkCsv1M4rc2/B/re6Rq6UWaY9+9F pEdw== 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=WZ40lQLRZ9Qku3eSrX7Z1ZfXZh74jtidVt6YdPRI94A=; b=BWih6fspwwrk6vlgIJXn4mIdaC14DyYXGS+qXvyiioxvZjN5CLAT32/VElCtM0VYwG T7NEBzrVJhiKRP9ksDGI3eqJxKMGy1Hs0mXWvcIqXlHwbAn0uTZqZQNDDqj+Jp0QerBu 0uYHoOIGbfgjPRtC7UCc1AgF6jT7CKyGVZxFQgu4lLNs9yKIuB8Yg5l1gJW+fxsMyOW7 oz0ed2BYnnh3wcfVgUConN3ZJOZDobzLggrzfoWkcO2Oe5LG5+9fEn/IdpQv01x7VN8L OVV7k6Oa8GlQXSWsE/+NBd8AAdaX3Gi/7GS0t6QwPU9/7ohM+EPSJfCxrlbwVjPx9KVW IpnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DVGWCL11; 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 n43si8611815edd.257.2019.09.09.00.13.35; Mon, 09 Sep 2019 00:13:59 -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=DVGWCL11; 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 S2436674AbfIGVNF (ORCPT + 99 others); Sat, 7 Sep 2019 17:13:05 -0400 Received: from mail-qk1-f193.google.com ([209.85.222.193]:38227 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406264AbfIGVNF (ORCPT ); Sat, 7 Sep 2019 17:13:05 -0400 Received: by mail-qk1-f193.google.com with SMTP id x5so9138053qkh.5 for ; Sat, 07 Sep 2019 14:13:04 -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=WZ40lQLRZ9Qku3eSrX7Z1ZfXZh74jtidVt6YdPRI94A=; b=DVGWCL11t9HhKdvGMIS39j3Cx0wFP0iI/b1YY7TvHHbrpLSjFusy12jTARGG5Y0lcK 2xOv5PTooPZpTuxcuzHszX5CigRZ14xFaCAyEXJrNQfr6aAgH9dcsKhDAn1mSJEHU7gY L0XnCQlN3riT2nbtGPOMaulYkpBzNLZLrnB9lgqzl9Os17U7mFLKUZ3Tj05488FZHSES 3Urg71yfxLx8cWTPq7v6KXoWeqT5L1YjQ/Tv6ZTuz4hSiaxxsrbmKf2Oq49Bf5F2htOY Mf8ot7Pj6fFJRqFoVLKNQjMA9EAFwlPq4Ns9465haSx845wo4r5z4NDu+Wrb29A79Oft FNBg== 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=WZ40lQLRZ9Qku3eSrX7Z1ZfXZh74jtidVt6YdPRI94A=; b=tgD4bFdJg/RclYIqZEFP7Ybf8X+ptoND3i6mmSKoL/wHfzkGxM8q85C6bSTzVu+HNL gxGtaAgBRqcpTCdEz+Pnio8OtKvf/XbCEkwvvXa3hJ9uUvDRY9v+2QjW+enlfuXkPTxZ kgbpHBtGi5YFUaaJ/skn9MspaFlfHRO7KvaPBza/ZyApoZZRr3tTIQP0QnzA4+quKaat uu3HwIRwqOUQ/MGXzI2mq5Y0JT0kix09OWefaV7JVWgCHHWr4lgI4aeh1OMFQ3762WDA AiKgsthb7RWqV5aPy5IPuB5sP2OtdyVGsw16hjz/FLyLmJNdhzLYKZ8zfZN3TaBJBMtE 6aOQ== X-Gm-Message-State: APjAAAVfYlGIU5uWJ4MB1iamHhv6S6tGqSyrw8SqW6aNQfaq/CqwgGtE tJfOuJ+FyAQNW6Y7CTtR9Ztk48s= X-Received: by 2002:a05:620a:1494:: with SMTP id w20mr16249585qkj.317.1567890783557; Sat, 07 Sep 2019 14:13:03 -0700 (PDT) Received: from [192.168.1.99] ([92.117.172.145]) by smtp.googlemail.com with ESMTPSA id 29sm5135881qkp.86.2019.09.07.14.13.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 07 Sep 2019 14:13:02 -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> From: Viktor Rosendahl Message-ID: Date: Sat, 7 Sep 2019 23:12:59 +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: <20190906141740.GA250796@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/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. best regards, Viktor