All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Jan Hubicka <hubicka@ucw.cz>
Cc: Jakub Jelinek <jakub@redhat.com>,
	David Rientjes <rientjes@google.com>,
	Matthew Wilcox <matthew@wil.cx>,
	LKML <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-fsdevel@vger.kernel.org, gcc@gcc.gnu.org,
	zadeck@naturalbridge.com
Subject: Re: [PATCH] linux/fs.h - Convert debug functions declared inline  __attribute__((format (printf,x,y) to statement expression macros
Date: Thu, 28 Feb 2008 17:09:07 -0800	[thread overview]
Message-ID: <1204247347.9959.31.camel@localhost> (raw)
In-Reply-To: <20080228102325.GC13246@atrey.karlin.mff.cuni.cz>

On Thu, 2008-02-28 at 11:23 +0100, Jan Hubicka wrote:
> The call ought to be always
> early inlined and not seen by any optimization pass.

The inlined functions don't actually appear in the generated code.

Look at the code generation differences for kernel/sched.c
function place_entity

$ size sched.inline.o sched.if0.o
   text    data     bss     dec     hex filename
  31385    2854     328   34567    8707 sched.inline.o
  31366    2854     328   34548    86f4 sched.if0.o

The current preprocessed only kernel/sched.i file contains:

# 612 "include/linux/device.h"
static inline __attribute__((always_inline)) int __attribute__ ((format (printf, 2, 3)))
dev_dbg(struct device *dev, const char *fmt, ...)
{
 return 0;
}
# 628 "include/linux/device.h"
static inline __attribute__((always_inline)) int __attribute__ ((format (printf, 2, 3)))
dev_vdbg(struct device *dev, const char *fmt, ...)
{
 return 0;
}

But the function place_entity doesn't use it directly or indirectly.
If the lines above are removed, the generated code for place_entity changes.

static void
place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial)
{
	u64 vruntime;

	vruntime = cfs_rq->min_vruntime;

	if (sched_feat(TREE_AVG)) {
		struct sched_entity *last = __pick_last_entity(cfs_rq);
		if (last) {
			vruntime += last->vruntime;
			vruntime >>= 1;
		}
	} else if (sched_feat(APPROX_AVG) && cfs_rq->nr_running)
		vruntime += sched_vslice(cfs_rq)/2;

	/*
	 * The 'current' period is already promised to the current tasks,
	 * however the extra weight of the new task will slow them down a
	 * little, place the new task so that it fits in the slot that
	 * stays open at the end.
	 */
	if (initial && sched_feat(START_DEBIT))
		vruntime += sched_vslice_add(cfs_rq, se);

	if (!initial) {
		/* sleeps upto a single latency don't count. */
		if (sched_feat(NEW_FAIR_SLEEPERS))
			vruntime -= sysctl_sched_latency;

		/* ensure we never gain time by being placed backwards. */
		vruntime = max_vruntime(se->vruntime, vruntime);
	}

	se->vruntime = vruntime;
}



WARNING: multiple messages have this Message-ID (diff)
From: Joe Perches <joe@perches.com>
To: Jan Hubicka <hubicka@ucw.cz>
Cc: Jakub Jelinek <jakub@redhat.com>,
	David Rientjes <rientjes@google.com>,
	Matthew Wilcox <matthew@wil.cx>,
	LKML <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-fsdevel@vger.kernel.org, gcc@gcc.gnu.org,
	zadeck@naturalbridge.com
Subject: Re: [PATCH] linux/fs.h - Convert debug functions declared inline __attribute__((format (printf,x,y) to statement expression macros
Date: Thu, 28 Feb 2008 17:09:07 -0800	[thread overview]
Message-ID: <1204247347.9959.31.camel@localhost> (raw)
In-Reply-To: <20080228102325.GC13246@atrey.karlin.mff.cuni.cz>

On Thu, 2008-02-28 at 11:23 +0100, Jan Hubicka wrote:
> The call ought to be always
> early inlined and not seen by any optimization pass.

The inlined functions don't actually appear in the generated code.

Look at the code generation differences for kernel/sched.c
function place_entity

$ size sched.inline.o sched.if0.o
   text    data     bss     dec     hex filename
  31385    2854     328   34567    8707 sched.inline.o
  31366    2854     328   34548    86f4 sched.if0.o

The current preprocessed only kernel/sched.i file contains:

# 612 "include/linux/device.h"
static inline __attribute__((always_inline)) int __attribute__ ((format (printf, 2, 3)))
dev_dbg(struct device *dev, const char *fmt, ...)
{
 return 0;
}
# 628 "include/linux/device.h"
static inline __attribute__((always_inline)) int __attribute__ ((format (printf, 2, 3)))
dev_vdbg(struct device *dev, const char *fmt, ...)
{
 return 0;
}

But the function place_entity doesn't use it directly or indirectly.
If the lines above are removed, the generated code for place_entity changes.

static void
place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial)
{
	u64 vruntime;

	vruntime = cfs_rq->min_vruntime;

	if (sched_feat(TREE_AVG)) {
		struct sched_entity *last = __pick_last_entity(cfs_rq);
		if (last) {
			vruntime += last->vruntime;
			vruntime >>= 1;
		}
	} else if (sched_feat(APPROX_AVG) && cfs_rq->nr_running)
		vruntime += sched_vslice(cfs_rq)/2;

	/*
	 * The 'current' period is already promised to the current tasks,
	 * however the extra weight of the new task will slow them down a
	 * little, place the new task so that it fits in the slot that
	 * stays open at the end.
	 */
	if (initial && sched_feat(START_DEBIT))
		vruntime += sched_vslice_add(cfs_rq, se);

	if (!initial) {
		/* sleeps upto a single latency don't count. */
		if (sched_feat(NEW_FAIR_SLEEPERS))
			vruntime -= sysctl_sched_latency;

		/* ensure we never gain time by being placed backwards. */
		vruntime = max_vruntime(se->vruntime, vruntime);
	}

	se->vruntime = vruntime;
}



  reply	other threads:[~2008-02-29  1:14 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-27  3:08 [PATCH] linux/kernel.h linux/device.h - Convert debug functions declared inline __attribute__((format (printf,x,y) to statement expression macros Joe Perches
2008-02-27  4:02 ` [PATCH] linux/fs.h " Joe Perches
2008-02-27  4:13   ` Matthew Wilcox
2008-02-27  4:55     ` Joe Perches
2008-02-27  5:44     ` David Rientjes
2008-02-27  5:44       ` David Rientjes
2008-02-27  6:54       ` Joe Perches
2008-02-27  7:38         ` David Rientjes
2008-02-27  7:38           ` David Rientjes
2008-02-27 22:58         ` David Rientjes
2008-02-27 22:58           ` David Rientjes
2008-02-27 23:58           ` Jan Hubicka
2008-02-28  8:28             ` David Rientjes
2008-02-28  8:28               ` David Rientjes
2008-02-28  8:42             ` Jakub Jelinek
2008-02-28 10:23               ` Jan Hubicka
2008-02-29  1:09                 ` Joe Perches [this message]
2008-02-29  1:09                   ` Joe Perches
2008-03-23 15:22                   ` Denys Vlasenko
2008-03-24 19:52                     ` Joe Perches
2008-03-24 19:52                       ` Joe Perches

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=1204247347.9959.31.camel@localhost \
    --to=joe@perches.com \
    --cc=gcc@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=jakub@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew@wil.cx \
    --cc=rientjes@google.com \
    --cc=torvalds@linux-foundation.org \
    --cc=zadeck@naturalbridge.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.