From: Eric Dumazet <eric.dumazet@gmail.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] speed up /proc/pid/stat, statm
Date: Wed, 01 Feb 2012 06:54:42 +0100 [thread overview]
Message-ID: <1328075682.2617.48.camel@edumazet-laptop> (raw)
In-Reply-To: <20120201085546.ecbf628d.kamezawa.hiroyu@jp.fujitsu.com>
Le mercredi 01 février 2012 à 08:55 +0900, KAMEZAWA Hiroyuki a écrit :
> seq_xxxx functions set m->count == m->size when it finds possible buffer overflow.
> If m->count == m->size after ->show(), buffer will be freed and twice size buffer
> will be re-allocated, and retry.
>
> If we don't set m->count == m->size here, following seq_putc() will succeed and
> we'll see corrupted outputs.
I suppose we could define a self documented helper
void seq_overflow(struct seq_file *seq)
{
seq->count = seq->size;
}
Or if we were counting the approximate number of missing bytes, we could
avoid some iterations of the "double size buffer".
(letting seq->count going above seq->size, but not allowing buffer
overflow of course !)
next prev parent reply other threads:[~2012-02-01 5:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-31 8:14 KAMEZAWA Hiroyuki
2012-01-31 20:36 ` Andrew Morton
2012-01-31 23:55 ` KAMEZAWA Hiroyuki
2012-02-01 5:54 ` Eric Dumazet [this message]
2012-02-01 8:56 ` KAMEZAWA Hiroyuki
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=1328075682.2617.48.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=kamezawa.hiroyu@jp.fujitsu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®