Re: [PATCH 2/3] mm: cma: introduce /proc/cmainfo

From: Stefan Strogin
Date: Fri Jan 23 2015 - 07:32:20 EST


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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/