lkml.org 
[lkml]   [2019]   [Oct]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 1/7] perf pmu: Use file system cache to optimize sysfs access
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

\
 
 \ /
  Last update: 2019-10-29 03:16    [W:0.036 / U:0.760 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site