public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: block: make blktrace use per-cpu buffers for message notes
Date: Thu, 29 May 2008 08:45:20 +0200	[thread overview]
Message-ID: <20080529064520.GJ25504@kernel.dk> (raw)
In-Reply-To: <20080528233801.e9e55eeb.akpm@linux-foundation.org>

On Wed, May 28 2008, Andrew Morton wrote:
> On Thu, 29 May 2008 08:22:15 +0200 Jens Axboe <jens.axboe@oracle.com> wrote:
> 
> > On Wed, May 28 2008, Andrew Morton wrote:
> > > On Wed, 28 May 2008 15:59:07 GMT Linux Kernel Mailing List <linux-kernel@vger.kernel.org> wrote:
> > > 
> > > > Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=64565911cdb57c2f512a9715b985b5617402cc67
> > > > Commit:     64565911cdb57c2f512a9715b985b5617402cc67
> > > > Parent:     4722dc52a891ab6cb2d637ddb87233e0ce277827
> > > > Author:     Jens Axboe <jens.axboe@oracle.com>
> > > > AuthorDate: Wed May 28 14:45:33 2008 +0200
> > > > Committer:  Jens Axboe <jens.axboe@oracle.com>
> > > > CommitDate: Wed May 28 14:49:27 2008 +0200
> > > 
> > > please try to avoid merging unreviewed changes.
> > 
> > Just because you didn't review it doesn't mean it's unreviewed :-)
> > 
> > It's not unreviewed, it was posted on lkml and a few version were
> > bounced back and forth.
> 
> OK.  The Subject: swizzling confounded me.
> 
> > > >  		if (unlikely(bt))					\
> > > >  			__trace_note_message(bt, fmt, ##__VA_ARGS__);	\
> > > >  	} while (0)
> > > > -#define BLK_TN_MAX_MSG		1024
> > > > +#define BLK_TN_MAX_MSG		128
> > > 
> > > It seems a bit strange to do this right when we've taken this _off_ the
> > > stack.  But I suppose nothing will break.
> > 
> > It was never on the stack, it was a global static char array. We are
> > still allocating memory for this, per-cpu. So I think it still makes
> > sense to shrink the size. It's really meant for small trace messages,
> > 128 bytes is plenty. It's an in-kernel property, the userland app
> > doesn't care. So we could easily grow this in the future, should the
> > need arise.
> 
> yup.
> 
> It's a bit sad to stage the data in a local per-cpu buffer and then
> copy it into relay's per-cpu buffer.  I guess this is because the
> length of the output isn't known beforehand.  Could be fixed by doing
> what kvasprintf() does, but that might well be slower.

I agree, this is what we debated. My reasoning is that it's better
to minimize usage of the relay buffer, so the stage-and-copy doesn't
matter a whole lot.

I seem to recall a relay_unreserve() patch from Tom back in the day,
if we had something like that we could do the optimal approach of:

        buf = relay_reserver(max_size);
        n = vscnprintf(buf, max_size, ...);
        if (max_size - n)
                relay_unreserve(max_size - n);

and get the best of both worlds. But, again, it's not really a big deal
I think.

My main interest in this is adding cfq trace messages, so we have
direct ways of comparing queue+dispatch with what cfq is deciding to
do.

-- 
Jens Axboe


  reply	other threads:[~2008-05-29  6:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200805281559.m4SFx7b9022392@hera.kernel.org>
2008-05-29  6:13 ` block: make blktrace use per-cpu buffers for message notes Andrew Morton
2008-05-29  6:22   ` Jens Axboe
2008-05-29  6:38     ` Andrew Morton
2008-05-29  6:45       ` Jens Axboe [this message]
2008-05-29  7:09         ` Jens Axboe
2008-05-29  7:20           ` Andrew Morton
2008-05-29  7:23             ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080529064520.GJ25504@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox