From: Pavel Emelyanov Subject: Re: [PATCH] ptrace: add ability to retrieve signals without removing from a queue (v2) Date: Mon, 25 Feb 2013 14:13:43 +0400 Message-ID: <512B3957.1020505@parallels.com> References: <1361786813-14652-1-git-send-email-avagin@openvz.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1361786813-14652-1-git-send-email-avagin-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org> Sender: linux-api-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Andrey Vagin Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, criu-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org, linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Roland McGrath , Oleg Nesterov , Andrew Morton , "Paul E. McKenney" , David Howells , Dave Jones , "Michael Kerrisk (man-pages)" , Linus Torvalds , Pedro Alves List-Id: linux-api@vger.kernel.org > + for (i = 0; i < arg.nr; i++) { > + off = arg.off + i; > + > + spin_lock_irq(&child->sighand->siglock); > + list_for_each_entry(q, &pending->list, list) { > + if (!off--) { > + copy_siginfo(&info, &q->info); > + break; > + } > + } > + spin_unlock_irq(&child->sighand->siglock); What's the point of arg.nr if you for every single siginfo drop the lock and perform linear search anyway? Thanks, Pavel