Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2555099pxb; Sat, 6 Feb 2021 00:08:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJyssoDTJE2nvlnqMA73xHtuhtmiRUeBN8Zwl0tmGmhhLvWTgiFXlmyyclIkMm5XbNPTkbr+ X-Received: by 2002:a17:907:98f3:: with SMTP id ke19mr7771349ejc.290.1612598883425; Sat, 06 Feb 2021 00:08:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612598883; cv=none; d=google.com; s=arc-20160816; b=e12FHkSybVGwVJlOPBoqk4CUA8S3YhefG+Vn7CStfUe4hvkUt2zr01vCiq5rHnHpwF FB1DE+Sj7CUH412rqPXAOHl8EGcl2edgsY8J4sapRr62px4cOC1zFstHJJQi328dS2n1 dAssyKOlCajeC6YSb9m1JtK5H8cSjt6F+1g3Rd6Nm8cq7McHrAbYUwPyjXmAvJqC1CKQ zMii2v2KmVkiFUp30C9uqtTnQZaJeauMhF9rK0QCb0KtVN1nZ06WyKnpJ6vzubddOIJg jHUBqPyYUrzfEWDz5WvrCd1fsJnX5A0KPhCDoPlgEB+WCIE3odUDLSsS+tfOR7hKriw8 bIRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=2c02oGcqajn71CZBW4vnCCBPytWY5m2465JnwumXBXE=; b=n+o2avJCXqjm2bLR4jLiKstK5bOuw9mrH8CFOaqva6qvcdGeo5WBGeI/h87UOHm9dN Z5GQWmjrMj5f1tV+50gPwczbOxyAO7nNnt6Gs5G/ftZpPg3jnU0OpkS1ectp6twPloOS FvX3pvqWuC2JNR3DN9xJ/Ld829TlHkhl7JX9gHMRuomUkg+bPMhyb+qWxaz8s1cDgqVo fbxm9dvBAsyoQHiVg3I8mKnWimyemADcbd537CEJQ49GyLesOS475Tt+PH71SS7pG4pA k7qchDD/ICDiVsme96UUSR2FuEIFNq698/iyN+PbsZapIE/lc4qjognEbBtF1vVzLyiA 0FvQ== 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g25si6915906edr.526.2021.02.06.00.07.38; Sat, 06 Feb 2021 00:08:03 -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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229703AbhBFIGG (ORCPT + 99 others); Sat, 6 Feb 2021 03:06:06 -0500 Received: from mail-lf1-f45.google.com ([209.85.167.45]:33970 "EHLO mail-lf1-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229539AbhBFIF6 (ORCPT ); Sat, 6 Feb 2021 03:05:58 -0500 Received: by mail-lf1-f45.google.com with SMTP id a12so13927889lfb.1 for ; Sat, 06 Feb 2021 00:05:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2c02oGcqajn71CZBW4vnCCBPytWY5m2465JnwumXBXE=; b=pybtnFsTBx+tiErldkwOPW7TSkTMlaMypC4mjuKI8YnpZkUrAGtPMWtVt6j+qB+FCz M3ywXR8qtQFU2rPkKQ6+h1wEDBDRDIYhkh8jA7MUf6HePaaY0myHlcuge4bwpsPgcp0C qojNCXKGxNCM+T1Yxya67KvZcPhekV+dEQqZ04g/0MvmuRw75se/eTrcYpp1jxkBavau j17OfowQ+2armx3ojxy7pnV5RWZcBGChsPctkAmh3IX2RnqB1lLE0mggZqgiHChlB/kI SyRBsR7Y4jNKw1/FsSHeE7SEGfHug5FW59w/aTSvzXA9zrwDOuKeW4zaaPPtbl9qDbqm XHjQ== X-Gm-Message-State: AOAM533yP5gSIYv0UDlR/U3cy8giq2JPPjEo6+A8nLFuBDMj5wwUFg98 QQr/BhT3LPOE+8jZSQQtLM1il+4kFVK/ccvCN60= X-Received: by 2002:a19:5c6:: with SMTP id 189mr4536671lff.300.1612598715736; Sat, 06 Feb 2021 00:05:15 -0800 (PST) MIME-Version: 1.0 References: <20210129134855.195810-1-jolsa@redhat.com> <20210130234856.271282-1-jolsa@kernel.org> <20210130234856.271282-7-jolsa@kernel.org> In-Reply-To: From: Namhyung Kim Date: Sat, 6 Feb 2021 17:05:04 +0900 Message-ID: Subject: Re: [PATCH 06/24] perf daemon: Add config file support To: Jiri Olsa Cc: Jiri Olsa , Arnaldo Carvalho de Melo , lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Michael Petlan , Ian Rogers , Stephane Eranian , Alexei Budankov Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 5, 2021 at 9:56 PM Jiri Olsa wrote: > > On Fri, Feb 05, 2021 at 09:14:54PM +0900, Namhyung Kim wrote: > > On Sun, Jan 31, 2021 at 8:49 AM Jiri Olsa wrote: > > [SNIP] > > > @@ -263,9 +605,16 @@ static int __cmd_start(struct daemon *daemon, struct option parent_options[], > > > signal(SIGTERM, sig_handler); > > > > > > while (!done && !err) { > > > - if (fdarray__poll(&fda, -1)) { > > > + err = daemon__reconfig(daemon); > > > > I think it's confusing since you put the reconfig function here. > > What not split normal and reconfig passes? > > hum, not sure what's confusing in here? I've been known to > produce confusing code, but this one seems clear to me Maybe it's because of the name. I thought reconfig is a special case when it detects some change. But you call it in the loop unconditionally. > > > > > I mean something like below > > > > __cmd_start() > > { > > setup_server_config(); > > daemon__run(); > > what's daemon__run? the daemon operates in the while loop below I thought about starting the sessions in the config. > > > > > while (!done && !err) { > > ... > > if (reconfig) { > > daemon__kill(); > > you don't kill daemon for each reconfig change, > we detect changed sessions and kill/restart only them Yep, we can make it that way. > > > setup_server_config(); > > daemon__reconfig(); > > } > > } > > > so basically the current workflow is: > > setup_server_config <--- reads config file, prepares session objects > > while (!done) { > daemon__reconfig <--- check session objects states and run/stop them Hmm.. then how about rename it to daemon__handle_state() or daemon__do_loop() or something? Thanks, Namhyung > > if (fdarray__poll(&fda, -1)) { > > handle_config_changes(&reconfig) <--- was there a config file change? > > if (reconfig) <--- yes, > setup_server_config <--- change session objects/states > } > } > > thanks, > jirka >