From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756574Ab1ERC5r (ORCPT ); Tue, 17 May 2011 22:57:47 -0400 Received: from one.firstfloor.org ([213.235.205.2]:58757 "EHLO one.firstfloor.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755436Ab1ERC5q (ORCPT ); Tue, 17 May 2011 22:57:46 -0400 Message-ID: <08d8c27c0495452cad52b62b362dd1d1.squirrel@www.firstfloor.org> In-Reply-To: <1305671358-14478-10-git-send-email-fenghua.yu@intel.com> References: <1305671358-14478-1-git-send-email-fenghua.yu@intel.com> <1305671358-14478-10-git-send-email-fenghua.yu@intel.com> Date: Wed, 18 May 2011 04:57:45 +0200 Subject: Re: [PATCH 9/9] x86/lib/memset_64.S: Optimize memset by enhanced REP MOVSB/STOSB From: "Andi Kleen" To: "Fenghua Yu" Cc: "Ingo Molnar" , "Thomas Gleixner" , "H Peter Anvin" , "Asit K Mallick" , "Linus Torvalds" , "Avi Kivity" , "Arjan van de Ven" , "Andrew Morton" , "Andi Kleen" , "linux-kernel" , "Fenghua Yu" User-Agent: SquirrelMail/1.4.21 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT X-Priority: 3 (Normal) Importance: Normal Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: Fenghua Yu > > Support memset() with enhanced rep stosb. On processors supporting > enhanced > REP MOVSB/STOSB, the alternative memset_c_e function using enhanced rep > stosb > overrides the fast string alternative memset_c and the original function. FWIW most memsets and memcpys are generated by modern gccs as inline code, depending on alignment etc., so will never call your new function. Same may be true for memmove (not fully sure) One way to work around this would be to add suitable logic to the string.h macros and make sure the out of line code is always called for large copies if the count is constant and large enough. There used to be such logic, but it was removed partly later. The only problem is that it's hard to decide if the count is variable and where a good threshold is. Or maybe it would be better to just fix gcc to use the new instructions, but then it would be difficult to patch them in. -Andi