Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp339933imu; Mon, 26 Nov 2018 11:37:54 -0800 (PST) X-Google-Smtp-Source: AFSGD/UjDk+PLIzqPtr2iC/ivMIljlJ/zDrMjHkfsW5QRGHS0zG7pDru4H14VF5PFbVRY1dNzQf5 X-Received: by 2002:a17:902:7e44:: with SMTP id a4mr29185608pln.338.1543261074685; Mon, 26 Nov 2018 11:37:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543261074; cv=none; d=google.com; s=arc-20160816; b=fCj3yD9uGTPyHn4ihE+Kethmb56O0UxngNU2VEAkVewcnmrp/DafDVnEGfrBagcuPJ n92Cqf2tEL2cM9sfCX5d8NE7KhXsUJ5oaQ91+8Vi1/jTvIzwa6AwZZBgokgMbcP7NTHQ /RiqHZgj9fP+eCMAhT853LJ+wdA7XWe+c2Zo03bc6R/P8tUul7+VCAfhDkGwCXS2B5FQ p5FNc44fHi1DDIeAAhrvfgMwBdVwxG6te13l5KSXuh5emmMNV4faC5EiNV8I1Yweukbw w7wjlB524XmwZ/R3PoMID9iUq2yVFz3f6isvoGmh9itH4XohosVbLQwgiiC7jPPd2vZL 2SNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=eUvKoxvllilS8RAwlb2OPwqR06skVtVxk65VhQd25vw=; b=n8wsBoCi45UbJe579I81q3RjtiaEKp4p/5ZfxEdjcZwA35f+wWE25iCFyA+DxO1Nil U7GIbKDCEqFpU1gi8LnsleG2LPI9GZhhiwIpz4NKhQMjsVK/T4yrn2TZllZkMZNL1BHz YyCoB+rIiIBVGUM30tvZTwMSP64VRwp23jEoRPSu1Rejw7uQ57NXd7n1yq224qQXFnXv ieZJDB9NrHUPTt0rA60SufmLuf5nqbag6gOaD6YmqtPMu++bBf/PVDvkVCmmetnHjq8u Z9xigvNfv/LwSsPCPd7J7CafaaTXWSFWO0+fu/CqScFGW4LSjJ3FhQw3H+FjhIu6ZaAL 176Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Zl0dzeIj; 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=QUARANTINE 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 i9si1167936plb.35.2018.11.26.11.37.29; Mon, 26 Nov 2018 11:37:54 -0800 (PST) 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=Zl0dzeIj; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726875AbeK0Gbl (ORCPT + 99 others); Tue, 27 Nov 2018 01:31:41 -0500 Received: from mail-ot1-f67.google.com ([209.85.210.67]:37160 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726140AbeK0Gbk (ORCPT ); Tue, 27 Nov 2018 01:31:40 -0500 Received: by mail-ot1-f67.google.com with SMTP id 40so17782714oth.4 for ; Mon, 26 Nov 2018 11:36:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=eUvKoxvllilS8RAwlb2OPwqR06skVtVxk65VhQd25vw=; b=Zl0dzeIjchfFdOfVOBrXyNXBwGJF5DcBctJq3YWOhLareMWJEemLppTHQdHzBE4Po9 lre4XJrd1dNRAXPizFHIUu8X1V0DCYkV6ulWRJ9RR7/aIhNE0yWBl1Uu6bK/RN4qrbdL b6Om6aEc4+Qzwv1FVtQNWsH0tYvyzwdT+m0rgxALrsLD3ltFB+ys+LGYDdXB6o714HJl KHA9DzCQBmkRGEoI8zUY4yQwhOOo33IRdZiTTEqAm4PhStSmRkW8CIjRz2OmXgm0YW60 hPQY9WqmH/maEFAGgKIoMmL0VPy1azWR33jDOmT2q0cRUPCLTf0C+mbs36qu5LEitatj XbIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=eUvKoxvllilS8RAwlb2OPwqR06skVtVxk65VhQd25vw=; b=e2/0RoJ8a/MSu2d/LAyN/orah6SHqQ6X3BIzRFNKDA20MD3rIpqe1RuZx5fKZTykKN lY513TDdGrD9fbgy+p1uB3p18QKChvQDxqMnzbdhjtUfeX7toFArDRCCmvBdVZE63DiV Bsx/1Y3sdN2fWE9mdeuDe1n4EDmsYRVpyW1hxRRRqni9EcgRlRG04tDzQ1YFZ7vXfwYB eFA/HYseNzS0Pv476WciugEf1hJa+qEK1HEi+t4j5xN2umodwkGwjJXNWJtDbzEvnDtP oAm2fPITOdbmt9VtsVS54Qcat5VHnyip9Q/j5BJ3e0qD/oDkptf90ljCkWqKQmfKm7MK SfFw== X-Gm-Message-State: AA+aEWZWmSUhk0SNBA2Pq0zn7hiBEUrYXXaELbkMMeLjL9qX8zSF4au8 4eZh8qt2WQkI19MyVex74Rd1rW6MZc/SYw7ZWHI= X-Received: by 2002:a9d:2c65:: with SMTP id f92mr16400470otb.18.1543260991862; Mon, 26 Nov 2018 11:36:31 -0800 (PST) MIME-Version: 1.0 References: <20181126113724.svbv6np25fzxkhrm@gmail.com> In-Reply-To: <20181126113724.svbv6np25fzxkhrm@gmail.com> From: David CARLIER Date: Mon, 26 Nov 2018 19:36:19 +0000 Message-ID: Subject: Re: [PATCH] Little memset_explicit optimisation To: joeypabalinas@gmail.com, linux-kernel@vger.kernel.org, alexander.shishkin@linux.intel.com, gregkh@linuxfoundation.org, andriy.shevchenko@linux.intel.com, aryabinin@virtuozzo.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sorry I m not used yet at all to LKML rules. So here a slight difference in assembly generated between the two versions (amd64) : ` .loc 1 7 7 leaq -12(%rbp), %rax movq %rax, -8(%rbp) - .loc 1 11 2 + .loc 1 9 6 movq -8(%rbp), %rax movl $4, %edx movl $0, %esi movq %rax, %rdi call memset@PLT + movq %rax, -8(%rbp) .loc 1 13 23 movq -8(%rbp), %rax movl (%rax), %eax ` On Mon, 26 Nov 2018 at 11:37, Joey Pabalinas wrote: > > On Sat, Nov 24, 2018 at 12:35:43PM +0000, David CARLIER wrote: > > Using the return value of memset for save/load sake. > > > > Signed-off-by: David Carlier > > --- > > lib/string.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/lib/string.c b/lib/string.c > > index 38e4ca08e757..92da04a0213b 100644 > > --- a/lib/string.c > > +++ b/lib/string.c > > @@ -720,7 +720,7 @@ EXPORT_SYMBOL(memset); > > */ > > void memzero_explicit(void *s, size_t count) > > { > > - memset(s, 0, count); > > + s = memset(s, 0, count); > > barrier_data(s); > > } > > EXPORT_SYMBOL(memzero_explicit); > > Could you elaborate on the optimization that this patch performs? > > -- > Cheers, > Joey Pabalinas