From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from p654782.hkidff01.ap.so-net.ne.jp ([121.101.71.130]:43562 "EHLO dns1.atmark-techno.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752100Ab1D1DCh (ORCPT ); Wed, 27 Apr 2011 23:02:37 -0400 Date: Thu, 28 Apr 2011 11:55:08 +0900 Message-ID: <87aafbt78z.wl@dns1.atmark-techno.com> (sfid-20110428_050241_874665_807CA0CC) From: Yasushi SHOJI To: helmut.schaa@googlemail.com Cc: ivdoorn@gmail.com Cc: hanada@atmark-techno.com Cc: linux-wireless@vger.kernel.org Subject: Re: [PATCH 04/23] rt2x00: Make rt2x00_queue_entry_for_each more flexible In-Reply-To: <201104181527.44542.IvDoorn@gmail.com> References: <201104181526.01722.IvDoorn@gmail.com> <201104181526.37747.IvDoorn@gmail.com> <201104181527.06956.IvDoorn@gmail.com> <201104181527.06956.IvDoorn-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> <201104181527.44542.IvDoorn@gmail.com> MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-wireless-owner@vger.kernel.org List-ID: Hi, At Mon, 18 Apr 2011 15:27:43 +0200, Ivo van Doorn wrote: > > From: Helmut Schaa > > Allow passing a void pointer to rt2x00_queue_entry_for_each which in > turn in provided to the callback function. > > Furthermore, allow the callback function to stop processing by returning > true. And also notify the caller of rt2x00_queue_entry_for_each if the > loop was canceled by the callback. My colleague just tested this patch set and found out that the in question makes our 400MHz ARM cpu board with ralink usb dongle non functional due to high cpu consumption. it seems for us that exiting from function every time it finds an entry is too expensive on systems slower than PCs. To verify our thought, we changed the source code as the patch below. What we intended to do with this change is to continue processing all entry without breaking semantics. With the patch below our board seem to work fine again, but not sure exactly why it takes so much time to check the list again. We are not against the idea of the patch at all. We just want to ask you guys how we should go to track this problem. it might be the slow usb? Thanks, > diff -urN compat-wireless-2011-04-26/drivers/net/wireless/rt2x00/rt2x00queue.c compat-wireless-2011-04-26-armadillo/drivers/net/wireless/rt2x00/rt2x00queue.c > --- compat-wireless-2011-04-26/drivers/net/wireless/rt2x00/rt2x00queue.c 2011-04-27 04:04:26.000000000 +0900 > +++ compat-wireless-2011-04-26-armadillo/drivers/net/wireless/rt2x00/rt2x00queue.c 2011-04-27 17:13:45.000000000 +0900 > @@ -740,6 +740,7 @@ > unsigned int index_start; > unsigned int index_end; > unsigned int i; > + bool ret = false; > > if (unlikely(start >= Q_INDEX_MAX || end >= Q_INDEX_MAX)) { > ERROR(queue->rt2x00dev, > @@ -766,21 +767,21 @@ > if (index_start < index_end) { > for (i = index_start; i < index_end; i++) { > if (fn(&queue->entries[i], data)) > - return true; > + ret = true; > } > } else { > for (i = index_start; i < queue->limit; i++) { > if (fn(&queue->entries[i], data)) > - return true; > + ret = true; > } > > for (i = 0; i < index_end; i++) { > if (fn(&queue->entries[i], data)) > - return true; > + ret = true; > } > } > > - return false; > + return ret; > } > EXPORT_SYMBOL_GPL(rt2x00queue_for_each_entry); -- yashi