All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Dave Jones <davej@redhat.com>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: sched_debug / traverse allocation failures.
Date: Tue, 6 Nov 2012 22:33:34 +0000	[thread overview]
Message-ID: <20121106223334.GL2616@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20121106204947.GA1762@redhat.com>

On Tue, Nov 06, 2012 at 03:49:47PM -0500, Dave Jones wrote:

> I added some instrumentation to traverse, and it appears that the /proc file
> in question is 'sched_debug'.
> 
> Most the time this is quite small, but can grow to large lengths it seems,
> which when we're under memory fragmentation results in the spew above.
> 
> >From my reading of the code, it doesn't actually use the seq_operations,
> to print out things record-at-a-time, but just dumps everything
> in its ->open routine.

Not ->open(), first ->read(), actually.  I'd suggest turning that
sucker into a saner iterator, though - it spews a smallish header
followed by a set of per-CPU entries, so I'd probably start with
something like
static void *c_start(struct seq_file *m, loff_t *pos)
{
	unsigned long n = *pos;
        if (n == 0)
		return (void *)1;	/* header */
	n--;
	/* find the first online CPU >= requested position */
	if (n > 0)
		n = cpumask_next(n - 1, cpu_online_mask);
	else
                n = cpumask_first(cpu_online_mask);
	*pos = n + 1;
        if (n < nr_cpu_ids)
                return (void *)(unsigned long)(n + 2);	/* CPU #n */
        return NULL;			/* EOF */
}

static void *c_next(struct seq_file *m, void *v, loff_t *pos)
{
        (*pos)++;
        return c_start(m, pos);
}

static int c_show(struct seq_file *m, void *v)
{
	if (v == (void *)1) {
		print header
	} else {
		unsigned long cpu = (unsigned long)v - 2;
		print for that cpu
	}
}

      reply	other threads:[~2012-11-06 22:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-06 20:49 sched_debug / traverse allocation failures Dave Jones
2012-11-06 22:33 ` Al Viro [this message]

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=20121106223334.GL2616@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=a.p.zijlstra@chello.nl \
    --cc=davej@redhat.com \
    --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 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.