[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-id: <54C23F49.8040109@partner.samsung.com>
Date: Fri, 23 Jan 2015 15:32:09 +0300
From: Stefan Strogin <s.strogin@...tner.samsung.com>
To: Gioh Kim <gioh.kim@....com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Cc: Stefan Strogin <stefan.strogin@...il.com>,
Michal Nazarewicz <mina86@...a86.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
Andrew Morton <akpm@...ux-foundation.org>,
Marek Szyprowski <m.szyprowski@...sung.com>,
aneesh.kumar@...ux.vnet.ibm.com,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Pintu Kumar <pintu.k@...sung.com>,
Weijie Yang <weijie.yang@...sung.com>,
Laura Abbott <lauraa@...eaurora.org>,
Hui Zhu <zhuhui@...omi.com>, Minchan Kim <minchan@...nel.org>,
Dyasly Sergey <s.dyasly@...sung.com>,
Vyacheslav Tyrtov <v.tyrtov@...sung.com>,
s.strogin@...tner.samsung.com
Subject: Re: [PATCH 2/3] mm: cma: introduce /proc/cmainfo
Hello Gioh,
On 31/12/14 04:14, Gioh Kim wrote:
>
> Is it ok if the information is too big?
> I'm not sure but I remember that seq_printf has 4K limitation.
Thanks for reviewing, excuse me for a long delay.
If I understand correctly it is OK, since it's written in comments for
seq_has_overflowed():
> * seq_files have a buffer which may overflow. When this happens a larger
> * buffer is reallocated and all the data will be printed again.
> * The overflow state is true when m->count == m->size.
And exactly this happens in traverse().
But I think that it's not important anymore as I intent not to use
seq_files in the second version.
>
> So I made seq_operations with seq_list_start/next functions.
>
> EX)
>
> static void *debug_seq_start(struct seq_file *s, loff_t *pos)
> {
> » mutex_lock(&debug_lock);
> » return seq_list_start(&debug_list, *pos);
> }
>
> static void debug_seq_stop(struct seq_file *s, void *data)
> {
> » struct debug_header *header = data;
>
> » if (header == NULL || &header->head_list == &debug_list) {
> » » seq_printf(s, "end of info");
> » }
>
> » mutex_unlock(&debug_lock);
> }
>
> static void *debug_seq_next(struct seq_file *s, void *data, loff_t *pos)
> {
> » return seq_list_next(data, &debug_list, pos);
> }
>
> static int debug_seq_show(struct seq_file *sfile, void *data)
> {
> » struct debug_header *header;
> » char *p;
>
> » header= list_entry(data,
> » » » struct debug_header,
> » » » head_list);
>
> » seq_printf(sfile, "print info");
> » return 0;
> }
> static const struct seq_operations debug_seq_ops = {
> » .start = debug_seq_start,
> » .next = debug_seq_next,
> » .stop = debug_seq_stop,
> » .show = debug_seq_show,
> };
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists