Received: by 10.223.164.221 with SMTP id h29csp3910104wrb; Wed, 4 Oct 2017 09:58:16 -0700 (PDT) X-Received: by 10.84.194.37 with SMTP id g34mr20834209pld.139.1507136296327; Wed, 04 Oct 2017 09:58:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507136296; cv=none; d=google.com; s=arc-20160816; b=0i9vDYyti/Gm5OEbGdULBk06QsIZKk0eIDboyJdZ7XZh5hxyl/CR/0x1By7kevIy1L ctZvJqakEUa1QHImwBKoTrUAzlzs2jzLdsoUNYE0Tc3LCX83V1h1Aed5ZvFSTdivUcpm wR/MgPbFDd75inlpGbeuZdKakp6oI/WbiHoBE5XsfSmdEMmkBuUmLrJ/8BRGggCYf7MI yZPOANdqxqWmMrcSEykiUvmAAoQCJMublA6V3d8RCiOuKdlsv2qH/wk3tQEgpa9KnBnD q9jxRNzJBmVNoOHrUj7l/5pEqRVlecWc7IK+BqlJSpHaks6lWn+WbehltCM3a5fDbYJW RDgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=Dgd7dKNQlSCWidur/x83cj1oz5H+yPYl5sh+5mhYl1M=; b=nvwP2HeKUGDawLYPE+ARTAqj7hOPDgt6Zn+pD3dDSdEHBbOEZCds8P0CDS4/p2kZNO BF3bu5MHL3vhyoBVkiNYkmLnP1IND3F2JU0vdi1bL99x6tl2bioUYVoQFOIHBkOeqvGg PvCrUONh10I2zIykdXq8ptx7MES/3gmIbEQ7ikjLHTTr2v2nccmFxLtkrrJGop6dIGyl bwP5ACmVnOanT+0fQoijnXgbecSp3VuhBMjkVsHtETRD+TXrCt9jXdkRSEeBQFxux/wN x8iIZEsroNAWE5Osom+B/l+Ez4Elr1vORHepUtkTcJgWkP+R1OEZ/Y3KGi84/E+PXaB5 2DfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DDBXty5c; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l185si8675461pgd.655.2017.10.04.09.58.01; Wed, 04 Oct 2017 09:58:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DDBXty5c; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751369AbdJDQ5Q (ORCPT + 99 others); Wed, 4 Oct 2017 12:57:16 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:36729 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751259AbdJDQ5O (ORCPT ); Wed, 4 Oct 2017 12:57:14 -0400 Received: by mail-pf0-f196.google.com with SMTP id f84so12777091pfj.3 for ; Wed, 04 Oct 2017 09:57:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Dgd7dKNQlSCWidur/x83cj1oz5H+yPYl5sh+5mhYl1M=; b=DDBXty5c97+yHZTjsjYAJAfkzRXt/eqStwAZl5jvF23TfccplN0aAGykK3ICi+asos WNb+IfNwTN/dqSSF+mMGUH8pLGOwXbq2ndH4ATSx64rxXkZybugSI9s/2fSyBdsLSnjB oYNfhc1sDrfE7TobAUk8QGhBLwb+/DpJTZBehHzkoRBja8Tui7R304uA7eadnBR+JGxT Ac/61sijA9RQ0VjHnUmCXXQtPGIgnUov2v+69wUAxuGJmLjDIG5+M74ut0DPNIh8kSJ2 FFa2hf0gsqFlRseQXIjt8bZNAt7jvFWZU0OSyciLBvUNB+10zs3/LdhKZiNt5MhSy3me xGnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Dgd7dKNQlSCWidur/x83cj1oz5H+yPYl5sh+5mhYl1M=; b=RyVWV6SZuS1C4KoJuaWp6e0Aq/qdS9yWnos3J5r9zemgQkGc2ds7bX1BHr6lN8xTpI NIyLrttFw3NZNYes9njAkp4bydTJdmd2IueOyKG1WX2eDleFskq2sfOP1/4OwSyzMRv7 sD+Sq8WEyNJRVb13KP6uAmfhtlwyckSfJGz8sVMGstgdfKIwNsvGnFAHPvdR0PLqG0V9 9EdAYV53HX3lyIFP2kfG1H2v7vbPtNbBGMK5l25C6ssTiLIeDHng1wiq6BicIP8vGkct Sc4q9qjyfaU1pioE7BK73mcV8sP6+HlKnPe0PEujvtKXU1JFx5nvPmziVK5slZqXy6AJ /bvw== X-Gm-Message-State: AHPjjUiWN8ubRrtiEOlTbeaJfW18mGFf0073pYtqhWWCGENhLVydvQGD WzHK4B6D/7KHtV7FjOYhJisY/KV4 X-Google-Smtp-Source: AOwi7QBc7eqQEsfmegyHim8NJnv5uP74+vUFY8+P3AJVjpZX6TzHXjHITiz60m+qZsG/RuKLjcmSLw== X-Received: by 10.98.158.139 with SMTP id f11mr21156865pfk.46.1507136233144; Wed, 04 Oct 2017 09:57:13 -0700 (PDT) Received: from linux.local ([43.224.131.58]) by smtp.gmail.com with ESMTPSA id i87sm28325076pfi.184.2017.10.04.09.57.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 Oct 2017 09:57:12 -0700 (PDT) From: PrasannaKumar Muralidharan To: linux-kernel@vger.kernel.org, dan.carpenter@oracle.com, mchehab@kernel.org, paul.burton@imgtec.com Cc: PrasannaKumar Muralidharan Subject: [PATCH] lib: memmove: Use optimised memcpy if possible Date: Wed, 4 Oct 2017 22:26:05 +0530 Message-Id: <20171004165605.17123-1-prasannatsmkumar@gmail.com> X-Mailer: git-send-email 2.10.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When there is no overlap between src and dst use optimised memcpy if it is available. Signed-off-by: Paul Burton Signed-off-by: PrasannaKumar Muralidharan --- This change is a small part of a patch [1] from Paul Burton. I have added his Signed-off by. I do not know whether it is correct. Please let me know if it has to be changed, I will send a v2. This patch is boot tested with qemu for MIPS architecture by removing mips's memmove routine. This patch does not contain MIPS changes. I will try to find out why [1] was not taken already and figure out what to do. 1. https://patchwork.linux-mips.org/patch/14517/ lib/string.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/string.c b/lib/string.c index 9921dc2..462ab7b 100644 --- a/lib/string.c +++ b/lib/string.c @@ -825,6 +825,17 @@ void *memmove(void *dest, const void *src, size_t count) char *tmp; const char *s; +#ifdef __HAVE_ARCH_MEMCPY + /* Use optimised memcpy when there is no overlap */ + const char *s_end = src + count; + const char *d = dest; + char *d_end = dest + count; + + s = src; + if ((d_end <= s) || (s_end <= d)) + return memcpy(dest, src, count); +#endif /* __HAVE_ARCH_MEMCPY */ + if (dest <= src) { tmp = dest; s = src; -- 2.10.0 From 1585204513115394051@xxx Mon Nov 27 07:47:10 +0000 2017 X-GM-THRID: 1584941598460632898 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread