Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KgrxC-0006tu-KQ for qemu-devel@nongnu.org; Fri, 19 Sep 2008 22:12:10 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KgrxC-0006ti-7Y for qemu-devel@nongnu.org; Fri, 19 Sep 2008 22:12:10 -0400 Received: from [199.232.76.173] (port=57367 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KgrxC-0006tf-2U for qemu-devel@nongnu.org; Fri, 19 Sep 2008 22:12:10 -0400 Received: from savannah.gnu.org ([199.232.41.3]:33560 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KgrxC-0006vI-6H for qemu-devel@nongnu.org; Fri, 19 Sep 2008 22:12:10 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1KgrxB-0008OD-Bl for qemu-devel@nongnu.org; Sat, 20 Sep 2008 02:12:09 +0000 Received: from balrog by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1KgrxA-0008O9-Tb for qemu-devel@nongnu.org; Sat, 20 Sep 2008 02:12:09 +0000 MIME-Version: 1.0 Errors-To: balrog Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Andrzej Zaborowski Message-Id: Date: Sat, 20 Sep 2008 02:12:08 +0000 Subject: [Qemu-devel] [5267] Swap only altered elements of the grouplist in getgroups() ( Kirill Shutemov). Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 5267 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5267 Author: balrog Date: 2008-09-20 02:12:08 +0000 (Sat, 20 Sep 2008) Log Message: ----------- Swap only altered elements of the grouplist in getgroups() (Kirill Shutemov). getgroups() returns the number of supplementary group IDs, so it's unnessary to swap the entire array. It can dramatically speed up the syscall: on recent Linux kernels NGROUPS_MAX=65536. Signed-off-by: Kirill A. Shutemov Modified Paths: -------------- trunk/linux-user/syscall.c Modified: trunk/linux-user/syscall.c =================================================================== --- trunk/linux-user/syscall.c 2008-09-20 02:08:13 UTC (rev 5266) +++ trunk/linux-user/syscall.c 2008-09-20 02:12:08 UTC (rev 5267) @@ -5253,7 +5253,7 @@ target_grouplist = lock_user(VERIFY_WRITE, arg2, gidsetsize * 2, 0); if (!target_grouplist) goto efault; - for(i = 0;i < gidsetsize; i++) + for(i = 0;i < ret; i++) target_grouplist[i] = tswap16(grouplist[i]); unlock_user(target_grouplist, arg2, gidsetsize * 2); } @@ -5407,7 +5407,7 @@ ret = -TARGET_EFAULT; goto fail; } - for(i = 0;i < gidsetsize; i++) + for(i = 0;i < ret; i++) target_grouplist[i] = tswap32(grouplist[i]); unlock_user(target_grouplist, arg2, gidsetsize * 4); }