Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2357926pxb; Fri, 5 Feb 2021 16:17:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJwrcbhm22W927MBvWnHrhlGtCBv+ZDNuMG9LDu/U3EoR+MJHQ8nqskJeMXESSDSdkO/qtKa X-Received: by 2002:a05:6402:5211:: with SMTP id s17mr6021987edd.312.1612570637936; Fri, 05 Feb 2021 16:17:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612570637; cv=none; d=google.com; s=arc-20160816; b=IzqZ+k/Ku6MHo41vySQxCuYIVZRcOmRjzWLUb4hVD/5t6Hxdb5RXviRd//PJ3K/YKT aFVyn7xQKOLdbVpBQbZijL+rqbxxg3mGY7ASYv76O6n1X9pk4yk4Qf6SJ2Sh0i0SZpn9 CIL/QPCM7pNNqY/IIVbl3ipPteM/OLwQ6S+qnoKmTohqNT5qo+vWyLaoERonbA+o6p6J mZlrtPJG7ukhby5WmVE/pDtqDxn+SVo4MMvYM1l7W0J662KY3Jlqmo72gbJrgKf2ctGy 8di3VVk3tXt1MPRACZCk33HohdhQEkmnLNd3UxaonEgmZxPWAv7k1g3LnTvLdzZ7ddQU KW/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=AA91MnBgvlIxFiOcioYnxLC4QDcpL1Xixn6HBYTlWRY=; b=WfjXOoQFdgosjpFGJ1DWevJB1lAssYR/Dg03FcpzRrGCPvVwCLESRtX8OKwX3Rls3w jUZOsUQ+c84g368kaYbcWg3GqZYi5sshSpWZov3kKzRaZgN7upogsIWQC9XRtwMxMxuz vshL/aI3QiI5TtbXKCSxY2dPPKThXJ8BMCqheUfmeoMUcISiVH2DcCLn+xKcD8fvdle+ 71nSKh+yVWN8kiSMO7KjoDNy0rBGGantrRZ5u+xp0jqdA2qwv/5Ncb/y3sQtJKwwpwdW XUH06TqzpTCG6dJ1DuE6+41/iVlolB4Z9JIECegtk8sL5OxZSv8gI30LDlmVwxcQ85Io yJNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IohhLGYP; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a66si8094827edf.607.2021.02.05.16.16.53; Fri, 05 Feb 2021 16:17:17 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IohhLGYP; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231245AbhBFAPd (ORCPT + 99 others); Fri, 5 Feb 2021 19:15:33 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:39465 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231784AbhBEM60 (ORCPT ); Fri, 5 Feb 2021 07:58:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612529815; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=AA91MnBgvlIxFiOcioYnxLC4QDcpL1Xixn6HBYTlWRY=; b=IohhLGYPNSC7/j/Vdb2rBoBhFcbYcyaGX4zrus2/zHjlpe9nAUHogUu94pgETV4pQ3ziYU obWcXJPDPyHwSUEZv8BY1AQ+WSngV0SLJgnxj7U6WMYnU3sYHmX43VBfYkW5ViMjIauDTh CslKCEwVsHc9/qUfFmOvENFLekRYZPQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-103-jq0XsNbkPsu1wbQAvsuNQA-1; Fri, 05 Feb 2021 07:56:51 -0500 X-MC-Unique: jq0XsNbkPsu1wbQAvsuNQA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 47716192CC4F; Fri, 5 Feb 2021 12:56:48 +0000 (UTC) Received: from krava (unknown [10.40.195.59]) by smtp.corp.redhat.com (Postfix) with SMTP id EC9685D9F8; Fri, 5 Feb 2021 12:56:42 +0000 (UTC) Date: Fri, 5 Feb 2021 13:56:42 +0100 From: Jiri Olsa To: Namhyung Kim Cc: Jiri Olsa , Arnaldo Carvalho de Melo , lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Michael Petlan , Ian Rogers , Stephane Eranian , Alexei Budankov Subject: Re: [PATCH 06/24] perf daemon: Add config file support Message-ID: References: <20210129134855.195810-1-jolsa@redhat.com> <20210130234856.271282-1-jolsa@kernel.org> <20210130234856.271282-7-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > I mean something like below > > __cmd_start() > { > setup_server_config(); > daemon__run(); what's daemon__run? the daemon operates in the while loop below > > 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 > 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 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