From patchwork Thu Feb 2 12:55:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 93102 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp84355qgi; Thu, 2 Feb 2017 04:56:10 -0800 (PST) X-Received: by 10.99.175.16 with SMTP id w16mr10643662pge.32.1486040170079; Thu, 02 Feb 2017 04:56:10 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 34si22205400plm.193.2017.02.02.04.56.09; Thu, 02 Feb 2017 04:56:10 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751639AbdBBM4D (ORCPT + 25 others); Thu, 2 Feb 2017 07:56:03 -0500 Received: from foss.arm.com ([217.140.101.70]:56628 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750808AbdBBM4B (ORCPT ); Thu, 2 Feb 2017 07:56:01 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B20F0152B; Thu, 2 Feb 2017 04:56:00 -0800 (PST) Received: from gby.kfn.arm.com (unknown [10.45.48.131]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C6EE33F242; Thu, 2 Feb 2017 04:55:59 -0800 (PST) From: Gilad Ben-Yossef To: linux-kernel@vger.kernel.org Cc: gilad.benyossef@arm.com, ofir.drang@arm.com Subject: [PATCH 1/2] scatterlist: reorder compound boolean expression Date: Thu, 2 Feb 2017 14:55:49 +0200 Message-Id: <1486040150-14109-2-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1486040150-14109-1-git-send-email-gilad@benyossef.com> References: <1486040150-14109-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Test the cheaper boolean expression with no side effects first. Signed-off-by: Gilad Ben-Yossef --- lib/scatterlist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.1.4 diff --git a/lib/scatterlist.c b/lib/scatterlist.c index 004fc70..393920f 100644 --- a/lib/scatterlist.c +++ b/lib/scatterlist.c @@ -666,7 +666,7 @@ size_t sg_copy_buffer(struct scatterlist *sgl, unsigned int nents, void *buf, local_irq_save(flags); - while (sg_miter_next(&miter) && offset < buflen) { + while ((offset < buflen) && sg_miter_next(&miter)) { unsigned int len; len = min(miter.length, buflen - offset); From patchwork Thu Feb 2 12:55:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 93103 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp84358qgi; Thu, 2 Feb 2017 04:56:10 -0800 (PST) X-Received: by 10.84.217.221 with SMTP id d29mr12381938plj.47.1486040170482; Thu, 02 Feb 2017 04:56:10 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 34si22205400plm.193.2017.02.02.04.56.10; Thu, 02 Feb 2017 04:56:10 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751660AbdBBM4G (ORCPT + 25 others); Thu, 2 Feb 2017 07:56:06 -0500 Received: from foss.arm.com ([217.140.101.70]:56636 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751626AbdBBM4C (ORCPT ); Thu, 2 Feb 2017 07:56:02 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 05FB4AD7; Thu, 2 Feb 2017 04:56:02 -0800 (PST) Received: from gby.kfn.arm.com (unknown [10.45.48.131]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1D76D3F242; Thu, 2 Feb 2017 04:56:00 -0800 (PST) From: Gilad Ben-Yossef To: linux-kernel@vger.kernel.org Cc: gilad.benyossef@arm.com, ofir.drang@arm.com Subject: [PATCH 2/2] scatterlist: do not disable IRQs in sg_copy_buffer Date: Thu, 2 Feb 2017 14:55:50 +0200 Message-Id: <1486040150-14109-3-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1486040150-14109-1-git-send-email-gilad@benyossef.com> References: <1486040150-14109-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 50bed2e2862a ("sg: disable interrupts inside sg_copy_buffer") introduced disabling interrupts in sg_copy_buffer() since atomic uses of miter required it due to use of kmap_atomic(). However, as commit 8290e2d2dcbf ("scatterlist: atomic sg_mapping_iter() no longer needs disabled IRQs") acknowledges disabling interrupts is no longer needed for calls to kmap_atomic() and therefore unneeded for miter ops either, so remove it from sg_copy_buffer(). Signed-off-by: Gilad Ben-Yossef --- lib/scatterlist.c | 4 ---- 1 file changed, 4 deletions(-) -- 2.1.4 diff --git a/lib/scatterlist.c b/lib/scatterlist.c index 393920f..c6cf822 100644 --- a/lib/scatterlist.c +++ b/lib/scatterlist.c @@ -651,7 +651,6 @@ size_t sg_copy_buffer(struct scatterlist *sgl, unsigned int nents, void *buf, { unsigned int offset = 0; struct sg_mapping_iter miter; - unsigned long flags; unsigned int sg_flags = SG_MITER_ATOMIC; if (to_buffer) @@ -664,8 +663,6 @@ size_t sg_copy_buffer(struct scatterlist *sgl, unsigned int nents, void *buf, if (!sg_miter_skip(&miter, skip)) return false; - local_irq_save(flags); - while ((offset < buflen) && sg_miter_next(&miter)) { unsigned int len; @@ -681,7 +678,6 @@ size_t sg_copy_buffer(struct scatterlist *sgl, unsigned int nents, void *buf, sg_miter_stop(&miter); - local_irq_restore(flags); return offset; } EXPORT_SYMBOL(sg_copy_buffer);