[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20110420112006.461A.A69D9226@jp.fujitsu.com>
Date: Wed, 20 Apr 2011 11:19:52 +0900 (JST)
From: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
To: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
Cc: kosaki.motohiro@...fujitsu.com,
Dave Hansen <dave@...ux.vnet.ibm.com>,
David Rientjes <rientjes@...gle.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, Johannes Weiner <hannes@...xchg.org>,
Michal Nazarewicz <mina86@...a86.com>,
Andrew Morton <akpm@...ux-foundation.org>,
John Stultz <johnstul@...ibm.com>
Subject: Re: [PATCH 1/2] break out page allocation warning code
> The concept is ok to me. but AFAIK some caller are now using ARRAY_SIZE(tsk->comm).
> or sizeof(tsk->comm). Probably callers need to be changed too.
one more correction.
> void set_task_comm(struct task_struct *tsk, char *buf)
> {
> + char tmp_comm[TASK_COMM_LEN];
> +
> task_lock(tsk);
>
> + memcpy(tmp_comm, tsk->comm_buf, TASK_COMM_LEN);
> + tsk->comm = tmp;
> /*
> - * Threads may access current->comm without holding
> - * the task lock, so write the string carefully.
> - * Readers without a lock may see incomplete new
> - * names but are safe from non-terminating string reads.
> + * Make sure no one is still looking at tsk->comm_buf
> */
> - memset(tsk->comm, 0, TASK_COMM_LEN);
> - wmb();
> - strlcpy(tsk->comm, buf, sizeof(tsk->comm));
> + synchronize_rcu();
The doc says,
/**
* synchronize_rcu - wait until a grace period has elapsed.
*
And here is under spinlock.
--
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