Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp131537imm; Thu, 2 Aug 2018 15:27:58 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeFfAGCBpeY+9W/MRlu8X79KUmhCqTU9tGkYf/WuhvVu6Y5A3tf18d0mBS9vzfi62DXmoUX X-Received: by 2002:a62:9d14:: with SMTP id i20-v6mr1402749pfd.3.1533248878685; Thu, 02 Aug 2018 15:27:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533248878; cv=none; d=google.com; s=arc-20160816; b=VFTeA0AQmfYc41mo/Jn6kcraDRA5/JkBCeS1neAiLW1ZeB3KKbGEsrbeC40L3dQI6v 49r5u5LsOMGxgUmNF63w1r/w7A2zUs40TViV5RNkMZbtI9n+jnzQDS6XYQmmg9AZ4ffE REOw8XJp3dEVuViLmpbYpVTSbeAEKSNU00JaPXp0oAf7UTtsqZCQrMpa4xC99Pg/Aebe Esdtspda5h4E7rf3YRGK8ysOBlqmVo3OMMqBDKcVD13QiPH6fvDUEd0nwFwazaR8gQsH bgUElrQGHGY4Turow9u3L1NGHqVv2kyNTrBdk6dSCDKqVM7GTI7INd4dle3+olhNs+b+ GOYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=8siXPD6pnnkkBabw1izHLCT9QjLpFKHUkM1VTZ9x638=; b=UBRl6RaO/DwWSyBMmBdO7VK4c5goMvEfGHop3RPcwQxfTN4nAKJl5DEaf142bvK8DH faFlSNVqaCi9t9j1Xw3DMg5QLCDxj8AnoJ3TqXwe5QcENhPDWUJPpSnvN7u7EzRdcwzz lLdLOgc6fMt5K8aZX+c46oSaCYZB3sf6ib2qDcq4qI7sqbr5t7ofyEhRlvjwKBOfigM7 ggZuwvvQ47DfhV9C7zKVPULgtTfDdIq/pzs/JXGpIMposvJ+S7RpXsWjioOS4BzClQBd jvogQ/tvgnIfqXkx2U78HEINfuuUb8JzLbwfXJrF5jciSjIGX8dhBwEklK7v7uUSALmz godQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k13-v6si3111050pgg.346.2018.08.02.15.27.44; Thu, 02 Aug 2018 15:27:58 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732365AbeHCATs (ORCPT + 99 others); Thu, 2 Aug 2018 20:19:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:35078 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732299AbeHCATr (ORCPT ); Thu, 2 Aug 2018 20:19:47 -0400 Received: from localhost.localdomain (c-98-220-238-81.hsd1.il.comcast.net [98.220.238.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6CD00215E4; Thu, 2 Aug 2018 22:26:36 +0000 (UTC) From: Tom Zanussi To: linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org Cc: rostedt@goodmis.org, tglx@linutronix.de, C.Emde@osadl.org, jkacur@redhat.com, bigeasy@linutronix.de, daniel.wagner@siemens.com, julia@ni.com, stable-rt@vger.kernel.org, Tom Zanussi Subject: [PATCH 09/15] squashfs: make use of local lock in multi_cpu decompressor Date: Thu, 2 Aug 2018 17:25:24 -0500 Message-Id: X-Mailer: git-send-email 2.14.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Julia Cartwright Currently, the squashfs multi_cpu decompressor makes use of get_cpu_ptr()/put_cpu_ptr(), which unconditionally disable preemption during decompression. Because the workload is distributed across CPUs, all CPUs can observe a very high wakeup latency, which has been seen to be as much as 8000us. Convert this decompressor to make use of a local lock, which will allow execution of the decompressor with preemption-enabled, but also ensure concurrent accesses to the percpu compressor data on the local CPU will be serialized. Cc: stable-rt@vger.kernel.org Reported-by: Alexander Stein Tested-by: Alexander Stein Signed-off-by: Julia Cartwright Signed-off-by: Sebastian Andrzej Siewior (cherry picked from commit c160736542d7b3d67da32848d2f028b8e35730e5) Signed-off-by: Tom Zanussi --- fs/squashfs/decompressor_multi_percpu.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/fs/squashfs/decompressor_multi_percpu.c b/fs/squashfs/decompressor_multi_percpu.c index 23a9c28ad8ea..6a73c4fa88e7 100644 --- a/fs/squashfs/decompressor_multi_percpu.c +++ b/fs/squashfs/decompressor_multi_percpu.c @@ -10,6 +10,7 @@ #include #include #include +#include #include "squashfs_fs.h" #include "squashfs_fs_sb.h" @@ -25,6 +26,8 @@ struct squashfs_stream { void *stream; }; +static DEFINE_LOCAL_IRQ_LOCK(stream_lock); + void *squashfs_decompressor_create(struct squashfs_sb_info *msblk, void *comp_opts) { @@ -79,10 +82,15 @@ int squashfs_decompress(struct squashfs_sb_info *msblk, struct buffer_head **bh, { struct squashfs_stream __percpu *percpu = (struct squashfs_stream __percpu *) msblk->stream; - struct squashfs_stream *stream = get_cpu_ptr(percpu); - int res = msblk->decompressor->decompress(msblk, stream->stream, bh, b, - offset, length, output); - put_cpu_ptr(stream); + struct squashfs_stream *stream; + int res; + + stream = get_locked_ptr(stream_lock, percpu); + + res = msblk->decompressor->decompress(msblk, stream->stream, bh, b, + offset, length, output); + + put_locked_ptr(stream_lock, stream); if (res < 0) ERROR("%s decompression failed, data probably corrupt\n", -- 2.14.1