Message ID | 20230713131932.133258-14-ilpo.jarvinen@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1827600vqm; Thu, 13 Jul 2023 06:32:26 -0700 (PDT) X-Google-Smtp-Source: APBJJlEQr40vTZ6Ku4yFb9HemxRseEYOP8jgxQA8Tv4jOWMuD1RMWYsvCQD+/Ap/un+ut/2i7ETx X-Received: by 2002:a05:6a21:7802:b0:132:424c:2c53 with SMTP id be2-20020a056a21780200b00132424c2c53mr1435617pzc.42.1689255145697; Thu, 13 Jul 2023 06:32:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689255145; cv=none; d=google.com; s=arc-20160816; b=V7+Rhj0jQ8PWr1nE5BAhCcNHEvorkmVduyYdwZzPJSR6nT/VZcbamOhYjO7xMqpk70 53GcdqyMad4sG4z9yT2NDt2vS/aIfjTgys501plyl9A1i0QjKJ5xbngIgGeR1+yevCZr +VnZe44ZyQdK4nIsdLQtZODgs2DeJ/dmczK832yjqNwBeJWayn/ueimuRC2nrDRnTYcO MyZI/Ayy3rVchxSa9JuKkq+56htYuP1dWQz3E2YPTzipANM7JsG38QzdsW0oYb4sppvB w/XBMPZjZ3RSLSD+SttWkgPbi6+EdeGkLYd9l6QCd+te4ia0LkTFQbaMeJrHboanpZ9o gx9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=MVISwwP3JQiC24iRbdI7NnGqdajFK67xiXdR7VNxsqA=; fh=yQZVCT9uasVczKlazciVDh1mdZVasudsfBJLxIYHjUw=; b=epPLBkwZqWYjzTFRLB8N6vBKT2mF54BNyy7x7B1gtJG/hFneLnvZGrRBz7dEeGii58 oINZ0IupTHx02202nFEN2EyJ/DBt8a1e72PA+eBIgrkg/ge3s2lY/DJDGhkyIqrQ1FLI C9jFtO5iPcxno410kBr/cakSlri8p7ZHBq5LbuMvEf+xj68tcQWtRSrhKYzqINXTCZ1l zu33xUm5uW/vmubNO9ID1UZ7/A8Il208+CceY42oiz+b/SMS2YM3shQVlPAGFH6UxTnd oXSt3quyDgYQ+lFIdHx60YcojMAJxuxpKjDKk0eeO9B0ArBdvipJfqNwX9KKuf7uXDeJ c2ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BnRdYpen; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 185-20020a6300c2000000b0055c99390901si377089pga.703.2023.07.13.06.32.12; Thu, 13 Jul 2023 06:32:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BnRdYpen; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235219AbjGMNWb (ORCPT <rfc822;tebrre53rla2o@gmail.com> + 99 others); Thu, 13 Jul 2023 09:22:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235230AbjGMNVs (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 13 Jul 2023 09:21:48 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C360A3A86; Thu, 13 Jul 2023 06:21:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689254468; x=1720790468; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ReRBurQsGT7Fx6kcQMK28MT5AqfN9HI/hJmNwwtabwY=; b=BnRdYpen7PLkJ50BgpCdFPcY41nVfSdp014hYo7XYw/FB5hjSqCcq5k5 R393md294KEDhZ/w4sJJrODGYeth7RNBq8da2bIhr1LIv4msRFhz0Ogdj wYoWm9Yvv/lz1PS9XUg/Njn7UYSjQ+gwHgP6SrmexRx123lWF0FtXn4MK siq9TkiIJBfOjJp6EAucLcdNqc6FDU6/4EOSVX7EJJka8//I31OYVmL9i 8ZUE1Kzw5OPoWomn2UC3RVb6dEA1RZGMDYysHsIKAqNGouq1H/9C53FmW H1Jw0LlDCIiF8G2vNpLVul5U2UVF00kXzSs1ZwgiSRYrOgP1S9H+srt+W g==; X-IronPort-AV: E=McAfee;i="6600,9927,10770"; a="345496870" X-IronPort-AV: E=Sophos;i="6.01,202,1684825200"; d="scan'208";a="345496870" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jul 2023 06:21:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10770"; a="968615904" X-IronPort-AV: E=Sophos;i="6.01,202,1684825200"; d="scan'208";a="968615904" Received: from ijarvine-mobl2.ger.corp.intel.com ([10.251.222.39]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jul 2023 06:20:58 -0700 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com> To: linux-kselftest@vger.kernel.org, Reinette Chatre <reinette.chatre@intel.com>, Shuah Khan <shuah@kernel.org>, Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>, Fenghua Yu <fenghua.yu@intel.com>, linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com> Subject: [PATCH v4 13/19] selftests/resctrl: Remove unnecessary startptr global from fill_buf Date: Thu, 13 Jul 2023 16:19:26 +0300 Message-Id: <20230713131932.133258-14-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230713131932.133258-1-ilpo.jarvinen@linux.intel.com> References: <20230713131932.133258-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771312403573938331 X-GMAIL-MSGID: 1771312403573938331 |
Series |
selftests/resctrl: Fixes and cleanups
|
|
Commit Message
Ilpo Järvinen
July 13, 2023, 1:19 p.m. UTC
fill_buf stores buffer pointer into global variable startptr that is
only used in fill_cache().
Remove startptr as global variable, the local variable in fill_cache()
is enough to keep the pointer.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
tools/testing/selftests/resctrl/fill_buf.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
Comments
Hi Ilpo, On 7/13/2023 6:19 AM, Ilpo Järvinen wrote: > fill_buf stores buffer pointer into global variable startptr that is > only used in fill_cache(). > > Remove startptr as global variable, the local variable in fill_cache() > is enough to keep the pointer. > > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> > --- Thank you. Reviewed-by: Reinette Chatre <reinette.chatre@intel.com> Reinette
diff --git a/tools/testing/selftests/resctrl/fill_buf.c b/tools/testing/selftests/resctrl/fill_buf.c index d8f5505eb9e6..a5ec9c82a960 100644 --- a/tools/testing/selftests/resctrl/fill_buf.c +++ b/tools/testing/selftests/resctrl/fill_buf.c @@ -22,8 +22,6 @@ #define PAGE_SIZE (4 * 1024) #define MB (1024 * 1024) -static unsigned char *startptr; - static void sb(void) { #if defined(__i386) || defined(__x86_64) @@ -147,7 +145,6 @@ static int fill_cache(size_t buf_size, int memflush, int op, char *resctrl_val) if (!start_ptr) return -1; - startptr = start_ptr; end_ptr = start_ptr + buf_size; /* Flush the memory before using to avoid "cache hot pages" effect */ @@ -159,7 +156,7 @@ static int fill_cache(size_t buf_size, int memflush, int op, char *resctrl_val) else ret = fill_cache_write(start_ptr, end_ptr, resctrl_val); - free(startptr); + free(start_ptr); if (ret) { printf("\n Error in fill cache read/write...\n");