From patchwork Tue Sep 15 01:05:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 53610 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by patches.linaro.org (Postfix) with ESMTPS id A5F2C22B17 for ; Tue, 15 Sep 2015 01:05:44 +0000 (UTC) Received: by wicmn1 with SMTP id mn1sf1820945wic.1 for ; Mon, 14 Sep 2015 18:05:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=3XKOtbIATyjsFxH5tQYoZTLjzfYbq53ovyVKlCpstck=; b=eX1Tqqi42HHck8kFw6osiYuGsmQhAMOgYbXMaPwAbO0LGy9tI/8vj4Iu/X7XXzX7io /lF1frrA78qWXxbNLZGplwtL8b25Yk0pyLo+zIzGGbOzemKqqI+wMcKXZI33Vi9OknqE E9NMcitQ5OK4UyZ27t4atMSF56WW/xgxB2ZxG4vusnnldYBOTbRqoDlQDVX4UBCm2E2M 5SRpsijjKNeDHbXyljtKWAf9bhNyhzVWO/gmyonYtp7fLTDnIDS7xu+nGoS+zG2ISWB/ cNyC49Q6cAtMP7Tj/vl1yBON9tii/OHlM8pid12kRLR2TaLNz6EL2Mge382ixwXmXpU9 79ZA== X-Gm-Message-State: ALoCoQnC2B/42dXGE88mIEfPZ7QRcItRKEB0obWmrUN3BJlvmptWETK+pZbTtJE5+yty5Ln1mLJL X-Received: by 10.112.135.104 with SMTP id pr8mr3734131lbb.4.1442279143902; Mon, 14 Sep 2015 18:05:43 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.225 with SMTP id e1ls725432laa.108.gmail; Mon, 14 Sep 2015 18:05:43 -0700 (PDT) X-Received: by 10.112.156.137 with SMTP id we9mr17466043lbb.110.1442279143758; Mon, 14 Sep 2015 18:05:43 -0700 (PDT) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id li9si11523261lbc.121.2015.09.14.18.05.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Sep 2015 18:05:43 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by lahg1 with SMTP id g1so67784631lah.1 for ; Mon, 14 Sep 2015 18:05:43 -0700 (PDT) X-Received: by 10.112.51.142 with SMTP id k14mr16269748lbo.76.1442279143649; Mon, 14 Sep 2015 18:05:43 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1489221lbq; Mon, 14 Sep 2015 18:05:42 -0700 (PDT) X-Received: by 10.69.12.33 with SMTP id en1mr40972033pbd.97.1442279137183; Mon, 14 Sep 2015 18:05:37 -0700 (PDT) Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com. [209.85.220.42]) by mx.google.com with ESMTPS id dq4si27854pbc.78.2015.09.14.18.05.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Sep 2015 18:05:37 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.42 as permitted sender) client-ip=209.85.220.42; Received: by pacfv12 with SMTP id fv12so162046962pac.2 for ; Mon, 14 Sep 2015 18:05:36 -0700 (PDT) X-Received: by 10.66.252.5 with SMTP id zo5mr36696878pac.96.1442279136218; Mon, 14 Sep 2015 18:05:36 -0700 (PDT) Received: from localhost.localdomain (c-76-115-103-22.hsd1.or.comcast.net. [76.115.103.22]) by smtp.gmail.com with ESMTPSA id td5sm18441531pbc.67.2015.09.14.18.05.35 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 14 Sep 2015 18:05:35 -0700 (PDT) From: John Stultz To: LKML Cc: John Stultz , Dave Chinner , Tejun Heo , Ingo Molnar Subject: [RFC][PATCH 4/5] percpu: Fix abs() usage in percpu_counter_compare() Date: Mon, 14 Sep 2015 18:05:23 -0700 Message-Id: <1442279124-7309-5-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1442279124-7309-1-git-send-email-john.stultz@linaro.org> References: <1442279124-7309-1-git-send-email-john.stultz@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , s64 values should not be used with abs(), as is one in __percpu_counter_compare(), since it may cap the result to 32-bits. This patch modifies __percpu_counter_compare() to use abs64() instead. Cc: Dave Chinner Cc: Tejun Heo Cc: Ingo Molnar Signed-off-by: John Stultz --- lib/percpu_counter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/percpu_counter.c b/lib/percpu_counter.c index f051d69..3d1aba9 100644 --- a/lib/percpu_counter.c +++ b/lib/percpu_counter.c @@ -203,7 +203,7 @@ int __percpu_counter_compare(struct percpu_counter *fbc, s64 rhs, s32 batch) count = percpu_counter_read(fbc); /* Check to see if rough count will be sufficient for comparison */ - if (abs(count - rhs) > (batch * num_online_cpus())) { + if (abs64(count - rhs) > (batch * num_online_cpus())) { if (count > rhs) return 1; else