I think that you can use one of the functions from include/linux/pid.h like this one:
struct pid *find_pid_ns(int nr, struct pid_namespace *ns)
292{
293 struct hlist_node *elem;
294 struct upid *pnr;
295
296 hlist_for_each_entry_rcu(pnr, elem,
297 &pid_hash[pid_hashfn(nr, ns)], pid_chain)
298 if (pnr->nr == nr && pnr->ns == ns)
299 return container_of(pnr, struct pid,
300 numbers[ns->level]);
301
302 return NULL;
303}
304EXPORT_SYMBOL_GPL(find_pid_ns)
And do not forget to lock the list as Bob suggest.
--
Regards,
Denis