netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
To: Joe Perches <joe@perches.com>
Cc: Matan Barak <matanb@mellanox.com>,
	Leon Romanovsky <leonro@mellanox.com>,
	netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mellanox: mlx5: Use logging functions to reduce text ~10k/5%
Date: Wed, 22 Jun 2016 14:40:56 -0600	[thread overview]
Message-ID: <20160622204056.GB20838@obsidianresearch.com> (raw)
In-Reply-To: <1466619839.13093.4.camel@perches.com>

On Wed, Jun 22, 2016 at 11:23:59AM -0700, Joe Perches wrote:

> The output changes now do not include line #, but do include the
> function offset.

I've been using a technique like this in some code with good results:

struct source_location
{
   const char *file;
   const char *func;
   const char *format;
   uint16_t line;
};
#define _LOCATION(format) ({static const source_location __location__ = {\
             __FILE__,__PRETTY_FUNCTION__,format,__LINE__};\
	     &__location__;})

void _mlx5_core_err(const struct source_location *loc,struct mlx5_core_dev *dev, ...);
#define mlx5_core_err(dev,format,...) _mlx_core_err(_LOCATION(format),dev,__VA_ARGS__)

The call site .text overhead is the about same as what you have, but
this still retains the function and line number information in
.rodata.

Jason

  reply	other threads:[~2016-06-22 20:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-22 18:23 [PATCH] mellanox: mlx5: Use logging functions to reduce text ~10k/5% Joe Perches
2016-06-22 20:40 ` Jason Gunthorpe [this message]
     [not found]   ` <20160622204056.GB20838-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-06-22 22:20     ` Joe Perches
     [not found] ` <1466619839.13093.4.camel-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
2016-06-23  5:27   ` Leon Romanovsky
     [not found]     ` <20160623052701.GB30933-2ukJVAZIZ/Y@public.gmane.org>
2016-06-23  7:12       ` Leon Romanovsky
2016-06-23  8:12       ` Saeed Mahameed
2016-06-23  8:09   ` Saeed Mahameed

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=20160622204056.GB20838@obsidianresearch.com \
    --to=jgunthorpe@obsidianresearch.com \
    --cc=joe@perches.com \
    --cc=leonro@mellanox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=matanb@mellanox.com \
    --cc=netdev@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;
as well as URLs for NNTP newsgroup(s).