Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4010443ybg; Tue, 29 Oct 2019 00:23:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqyKKFKLeejaM3n16JfhGvOOWWCrI5ntMACoyaf2zY+kcs7Na8OkU5io7uuQwL6b4LDV2gOq X-Received: by 2002:a50:9fc1:: with SMTP id c59mr24561002edf.305.1572333814831; Tue, 29 Oct 2019 00:23:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572333814; cv=none; d=google.com; s=arc-20160816; b=lJ7chyykZ85NxnhbFqIKNMUxBkrrIjIAFst3FXcW0ZiIgyuAcomiAnmDAflUmF1nVU 0QC0FrLmyw/GRJ60/JV2/0JN63gNIK6We1ZApFQCKbdypurhVP7QjlZCsT3JS6V2NIJ9 +kxjv/UTOWUr0+++zC5mLpvV/9J1mMIQCzezO4IgVcagj2BFJUDgTJ+JFwHCqhsMrqKa /tbLTFXi8UA57OcBw2Qylvblbf+Z6JeXmKqC6SoOTujoI1DPf2dhOqgduvMJnEKoP42z WibLOoUA0ACnxPsDdM6CjvaOkw1f+dK0PBPMU9lhxHZYi4loPdSdV5aNNSJYboB2GT30 nz9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=zu3+G9ceR9snK9yhl1/CT88+295JtAL9YIrwMsgbQHg=; b=YXNStRiJx/h1OaBs3k65ft3XVMAj+YtsctB+jCvO05/OaH1lBo0QtcyuzH2Yrp5qUk R0viVR8ufgv1BCxtp1nvxLc0PuOBtr+jUwnjxMvNXN4gRplP4aY3pnhppCexRdwyFlBJ ND7wcIhacu0IAFkMjNwVx1IMS+iWhdtAL9LyUw07f3gR/azMdKHlRpyXcwuM9hAQc5aN 1zYnMh1JyMSDbz0i/4xyOWL9w/fAh9eX7vly8Xo9cb39cMN/lssZYnZdHXWhzeQasV6A crx/3Of3CFxFIETC0WedBU0WfT5H+ttalGERqe0OA1w037NrW+sj2qwIfzdx+085SuNO tetQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gw3si7394096ejb.385.2019.10.29.00.23.10; Tue, 29 Oct 2019 00:23:34 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730475AbfJ2COV (ORCPT + 99 others); Mon, 28 Oct 2019 22:14:21 -0400 Received: from mga02.intel.com ([134.134.136.20]:11033 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729412AbfJ2COV (ORCPT ); Mon, 28 Oct 2019 22:14:21 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Oct 2019 19:14:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,242,1569308400"; d="scan'208";a="205342149" Received: from tassilo.jf.intel.com (HELO tassilo.localdomain) ([10.7.201.137]) by FMSMGA003.fm.intel.com with ESMTP; 28 Oct 2019 19:14:20 -0700 Received: by tassilo.localdomain (Postfix, from userid 1000) id 0198C301C0F; Mon, 28 Oct 2019 19:14:19 -0700 (PDT) Date: Mon, 28 Oct 2019 19:14:19 -0700 From: Andi Kleen To: Jiri Olsa Cc: Andi Kleen , acme@kernel.org, jolsa@kernel.org, eranian@google.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 1/7] perf pmu: Use file system cache to optimize sysfs access Message-ID: <20191029021419.GT4660@tassilo.jf.intel.com> References: <20191025181417.10670-1-andi@firstfloor.org> <20191025181417.10670-2-andi@firstfloor.org> <20191028220137.GF28772@krava> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191028220137.GF28772@krava> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 28, 2019 at 11:01:37PM +0100, Jiri Olsa wrote: > On Fri, Oct 25, 2019 at 11:14:11AM -0700, Andi Kleen wrote: > > SNIP > > > if (pmu_aliases_parse(path, head)) > > return -1; > > @@ -525,7 +524,6 @@ static int pmu_alias_terms(struct perf_pmu_alias *alias, > > */ > > static int pmu_type(const char *name, __u32 *type) > > { > > - struct stat st; > > char path[PATH_MAX]; > > FILE *file; > > int ret = 0; > > @@ -537,7 +535,7 @@ static int pmu_type(const char *name, __u32 *type) > > snprintf(path, PATH_MAX, > > "%s" EVENT_SOURCE_DEVICE_PATH "%s/type", sysfs, name); > > > > - if (stat(path, &st) < 0) > > + if (access(path, R_OK) < 0) > > why not file_available call in here? iirc it doesn't do any redundant accesses. -Andi