From owner-svn-src-all@FreeBSD.ORG Thu Oct 2 17:42:03 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8D4DBE3B; Thu, 2 Oct 2014 17:42:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 792FA7CB; Thu, 2 Oct 2014 17:42:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s92Hg3sG006304; Thu, 2 Oct 2014 17:42:03 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s92Hg3Kl006303; Thu, 2 Oct 2014 17:42:03 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410021742.s92Hg3Kl006303@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 2 Oct 2014 17:42:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r272426 - stable/9/sys/cddl/boot/zfs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Oct 2014 17:42:03 -0000 Author: delphij Date: Thu Oct 2 17:42:02 2014 New Revision: 272426 URL: https://svnweb.freebsd.org/changeset/base/272426 Log: MFC r272389: Diff reduction with kernel code: instruct the compiler that the data of these types may be unaligned to their "normal" alignment and exercise caution when accessing them. PR: 194071 Modified: stable/9/sys/cddl/boot/zfs/lz4.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cddl/boot/zfs/lz4.c ============================================================================== --- stable/9/sys/cddl/boot/zfs/lz4.c Thu Oct 2 17:41:27 2014 (r272425) +++ stable/9/sys/cddl/boot/zfs/lz4.c Thu Oct 2 17:42:02 2014 (r272426) @@ -83,6 +83,17 @@ lz4_decompress(void *s_start, void *d_st #endif /* + * Unaligned memory access is automatically enabled for "common" CPU, + * such as x86. For others CPU, the compiler will be more cautious, and + * insert extra code to ensure aligned access is respected. If you know + * your target CPU supports unaligned memory access, you may want to + * force this option manually to improve performance + */ +#if defined(__ARM_FEATURE_UNALIGNED) +#define LZ4_FORCE_UNALIGNED_ACCESS 1 +#endif + +/* * Compiler Options */ #if __STDC_VERSION__ >= 199901L /* C99 */ @@ -113,6 +124,10 @@ lz4_decompress(void *s_start, void *d_st #define S32 int32_t #define U64 uint64_t +#ifndef LZ4_FORCE_UNALIGNED_ACCESS +#pragma pack(1) +#endif + typedef struct _U16_S { U16 v; } U16_S; @@ -123,6 +138,10 @@ typedef struct _U64_S { U64 v; } U64_S; +#ifndef LZ4_FORCE_UNALIGNED_ACCESS +#pragma pack() +#endif + #define A64(x) (((U64_S *)(x))->v) #define A32(x) (((U32_S *)(x))->v) #define A16(x) (((U16_S *)(x))->v)