[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201401062302.FJG51045.tFSOFJQLOOHFMV@I-love.SAKURA.ne.jp>
Date: Mon, 6 Jan 2014 23:02:09 +0900
From: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
To: pavel@....cz
Cc: keescook@...omium.org, joe@...ches.com, akpm@...ux-foundation.org,
geert@...ux-m68k.org, jkosina@...e.cz, viro@...iv.linux.org.uk,
davem@...emloft.net, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] lib/vsprintf: add %pT[C012] format specifier
Pavel Machek wrote:
> > + * Please use this wrapper function which will be updated in the future to read
> > + * @tsk->comm in a consistent way.
> > + */
> > +static inline int commcmp(const struct task_struct *tsk, const char *comm)
> > +{
> > + return strcmp(tsk->comm, comm);
> > +}
>
> Is this useful to something? Printing command name is
> useful. Comparing it...?
>
(a) Using tsk->comm for reducing duplicated printk() messages.
if (strcmp(p->comm, last_comm)) {
printk("hello\n");
strcpy(last_comm, p->comm);
}
(b) Using tsk->pid for reducing duplicated printk() messages.
if (p->pid != last_pid) {
printk("hello\n");
last_pid = p->pid;
}
(c) Using printk_ratelimit() for reducing printk() flooding.
printk_ratelimit("hello\n");
(d) Using plain printk().
printk("hello\n");
(e) Other purposes. (e.g. drivers/target/iscsi/iscsi_target_tq.c )
if (!strncmp(current->comm, ISCSI_RX_THREAD_NAME,
strlen(ISCSI_RX_THREAD_NAME)))
thread_called = ISCSI_RX_THREAD;
else if (!strncmp(current->comm, ISCSI_TX_THREAD_NAME,
strlen(ISCSI_TX_THREAD_NAME)))
thread_called = ISCSI_TX_THREAD;
commcmp() and commcpy() are for wrappring (a).
Though (a) should consider changing to (b) or (c).
(e) should be rewritten not to depend on current->comm .
--
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