Re: [PATCH] trace-cmd: Try alternate path for message cache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 4, 2022 at 4:21 PM Joel Fernandes <joel@xxxxxxxxxxxxxxxxx> wrote:
>
> On Mon, Apr 4, 2022 at 1:03 AM Tzvetomir Stoyanov <tz.stoyanov@xxxxxxxxx> wrote:
> >
> > On Mon, Apr 4, 2022 at 7:41 AM Tzvetomir Stoyanov <tz.stoyanov@xxxxxxxxx> wrote:
> > >
> > > On Sun, Apr 3, 2022 at 5:56 PM Joel Fernandes <joel@xxxxxxxxxxxxxxxxx> wrote:
> > > >
> > > > On Fri, Apr 01, 2022 at 07:06:29PM -0400, Steven Rostedt wrote:
> > > > > On Fri, 1 Apr 2022 15:50:10 -0400
> > > > > Joel Fernandes <joel@xxxxxxxxxxxxxxxxx> wrote:
> > > > >
> > > > > > export TRACECMD_TEMPDIR="/data"
> > > > > >
> > > > > > That’s fair. What about using memfd for this, do you feel that’s
> > > > > > reasonable? I have not yet measured how big this file gets but if it’s
> > > > > > small enough that might work too.
> > > > >
> > > > > Is this a separate question? That is, do you mean using the above
> > > > > environment variable *and* then use memfd?
> > > > >
> > > > > I believe that the cache is used for passing the compressed data from the
> > > > > guest to the host. I don't think it will be more than one compressed chunk.
> > > > >
> > > > > But Tzvetomir would know better.
> > > >
> > > > Hey Steve,
> > > > No its the same question. Instead of temp file, I was proposing in-memory
> > > > file using memfd_create(2), that way no hassle as long as the file is not too
> > > > huge.
> > > >
> > >
> > > Hi  Joel,
> > > That cache file is used for constructing the trace meta-data on the
> > > guest, before sending it to the host. Usually it is compressed, but it
> > > could be uncompressed in some cases (depending on the configuration) -
> > > and in that case it can grow up to a few megabytes. Using memfd is ok
> > > in most cases, but I'm wondering in the worst case - these few
> > > megabytes could be a problem, especially if the guest runs with a
> > > minimum amount of memory.
> > >
> >
> > Can you check that file size on your Android setup with that command,
> > it will force to not use compression on the guest trace file:
> >    trace-cmd <host trace options> -A <guest> <guest trace options>
> > --file-version 7 --compression none
>
> The file grows to 5.3MB with this. Is this really the common case
> though? If not, I would still prefer memfd tbh. Is that Ok with you?
>

There are two cases that could hit this:
 1. Using a " --compression none" flag on the guest file. We could
disable that flag and force trace file v7 always to use compression. I
cannot imagine a use case for uncompressed trace file, maybe only for
debug purposes ?
 2. If, for some reason, there are no supported compression libraries
on the guest. Trace-cmd supports libz and libzstd, I believe both are
widely available. Theoretically it could be possible to have some
minimalistic VM image without any of these libraries.
What are the advantages of using memfd instead of temp file, is it
only for performance ? Usually collecting trace metadata is not
performance critical, as it is done before starting the trace.
I think that the best solution is to use memfd in case the guest file
is compressed and switch back to a temp file in case of a
not-compressed file.


> Thanks,
>
> - Joel



-- 
Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux