lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 17 Dec 2018 06:42:50 -0800
From:   Eric Dumazet <eric.dumazet@...il.com>
To:     Eric Dumazet <edumazet@...gle.com>,
        linux-kernel <linux-kernel@...r.kernel.org>
Cc:     Eric Dumazet <eric.dumazet@...il.com>,
        Al Viro <viro@...iv.linux.org.uk>
Subject: Re: [PATCH] iov_iter: optimize page_copy_sane()



On 12/08/2018 05:37 AM, Eric Dumazet wrote:
> Avoid cache line miss dereferencing struct page if we can.
> 
> page_copy_sane() mostly deals with order-0 pages.
> 
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> Cc: Al Viro <viro@...iv.linux.org.uk>
> ---
>  lib/iov_iter.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/iov_iter.c b/lib/iov_iter.c
> index 54c248526b55fc498c996f2a5ea651262fcc7f61..2a1e282c3d38e2d03b075f54b7f9313e48b90289 100644
> --- a/lib/iov_iter.c
> +++ b/lib/iov_iter.c
> @@ -854,8 +854,18 @@ EXPORT_SYMBOL(_copy_from_iter_full_nocache);
>  
>  static inline bool page_copy_sane(struct page *page, size_t offset, size_t n)
>  {
> -	struct page *head = compound_head(page);
> -	size_t v = n + offset + page_address(page) - page_address(head);
> +	struct page *head;
> +	size_t v = n + offset;
> +
> +	/*
> +	 * Fast path if this is an order-0 page,
> +	 * or if the copied area fits the first page of a compound one.
> +	 */
> +	if (likely(n <= v && v <= PAGE_SIZE))
> +		return true;
> +
> +	head = compound_head(page);
> +	v += (page - head) << PAGE_SHIFT;
>  
>  	if (likely(n <= v && v <= (PAGE_SIZE << compound_order(head))))
>  		return true;
> 

Hi Alexander !

Any news on this patch ?

Thanks !

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ