Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp692446pxj; Fri, 28 May 2021 13:13:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzR6qWK3/CGyEsuCotvwZ3KvlwU8c+W0NXY3TlC6VfrKyJCY6kWRuBqJkQC2rF7jyCM1g6w X-Received: by 2002:a05:6402:1158:: with SMTP id g24mr11661980edw.134.1622232831083; Fri, 28 May 2021 13:13:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622232831; cv=none; d=google.com; s=arc-20160816; b=X49FGaFDhdRiZd8s0llZ/LR+bgH4Bs6nZnhOlfcglHjAK6RqI7KVf3CjBe8th9BIOU 8jNIkcrElj0iaWDAHRMxA0PTCGi6FKP+hKL64qf+cTiy5hFCzjUwGy54GuXvfML8GZzU 1+Inh9TQ17vAUvi7cKZIvJ7CObr2c4l6bpBIbBOtQyIsYfl1ShuWuHBSJqhEh7acDN9q wGExZr2vHmOIzItEQi8k5pXq7TiQcUEVwDVbPsRjBL4J/9lhkef7oIUJwGMC7clWceOj eo7hzTAJiVaojs1Wz4pPTM94QQyE1Acb1eZ0X4BKD72tgOn5+lOgo3jLLuKHT8K9u+Lf ap4g== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=730RyWLlIkS/afgq41VA6uiOuJV1jg//1PGLIJFflks=; b=ZaoObNOoYt5nLrFJYW1qAwc98cgrQzyIj9rmGfVe+WB05ZmMJyPzfHlkeCuS5SqgKK eSMWkMp+BARK40t7wfkmHwDZCyOs8f+sh7TsQnUmaZmJBTBClWDkbwPCMD6GpGfZ5WUQ xx0s1BPc5ay208rwkK6iBK1CcL+tqA03fd2xJSzFW1cmxG8/awNVtfQJX14CsJwHfyek uMhzuiTQ0soOd/Hxe6OMCvfFrfPwTF7SsxwP3b0gXmHwnYts7Bbrw1hCv2B3WZinDK79 VQymnlmpW2l3zlmZOwAZss7kwePV5lhk0YHMOk2t0uFG6xwObXRpkXHWxBx94F+9tPFv mmHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BQ50Ftej; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ga4si5153088ejc.497.2021.05.28.13.13.28; Fri, 28 May 2021 13:13:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BQ50Ftej; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229547AbhE1UOB (ORCPT + 99 others); Fri, 28 May 2021 16:14:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229522AbhE1UN5 (ORCPT ); Fri, 28 May 2021 16:13:57 -0400 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46234C061574 for ; Fri, 28 May 2021 13:12:21 -0700 (PDT) Received: by mail-lj1-x22c.google.com with SMTP id 131so6794650ljj.3 for ; Fri, 28 May 2021 13:12:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=730RyWLlIkS/afgq41VA6uiOuJV1jg//1PGLIJFflks=; b=BQ50FtejrBVyVqQUY/NBLy9VUR41u+QA76G1LEStdWRUZebctaoGJgefENCsC7X3uH mwgWf7xp+6cFf1urBc6X1nv4zEHIqt+VkUoE9UGXVCiyBRj4+8oJqGy6RkSQaea3NBVn sdabQBUwfPQFqjJYzAjQN8EljA8VVRPttQBB0a5d2aoRPVNZ3+0tSLxGljTQ4eh60ra3 hxygaZwSLfmGUvC9jVjchooqV/hKujjWUcXY6uvMlyDh6SBVH8EdXGmsgEgdOu6HDK27 uREc2v2lkqfZs4jGf+ubCqr0fHadrZlpndswfMDvDUtWmJUGiLll7a1aBR5+86kwiUHG TjUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=730RyWLlIkS/afgq41VA6uiOuJV1jg//1PGLIJFflks=; b=IQ5SUxmImDCzTQCjwowKiJkb+Qx/AcO39Q3UafpxfuSEJpiUoxt57frrkRBhrvfDb2 Hqa0C2PfPH7VPuv/yACpysXRXFsSd2y7rkpnaeHGi5TZ5yeB05ZZzh4Hz7rkLJYnhTYN yV7YrKqqLXkKn+yanLHNQiL9TdtR/n31koJ/FeQ+Xv0QfKqY0LTywhRPtIT9WyIQ3Dyq y6UWNKvxicgGtRcbWeOvUM0MnwgSr40sh7CjhlGJ4RsUTDa7K3z6jEhadIZnQu+W7rOl d5ylkdvKHkfB6JI9TlR8JRvGNjugQatfYrLNLVUzBvnuhQtYqUlC42rzOIR1MyDdBDQf Ooqw== X-Gm-Message-State: AOAM532AG+ycflimJVQUuvHXszWCPLyqWHkgzbMtrG0Rh4Hn7+GX+f6N iWnsQqalwDRufNFWsWtR37c= X-Received: by 2002:a2e:b4f3:: with SMTP id s19mr7781563ljm.10.1622232739678; Fri, 28 May 2021 13:12:19 -0700 (PDT) Received: from HyperiorArchMachine.bb.dnainternet.fi (dcx7x4yg81q1---xrfn1y-3.rev.dnainternet.fi. [2001:14ba:14f7:3c00:bcab:6bff:fe6e:22ea]) by smtp.gmail.com with ESMTPSA id u16sm550980lfl.83.2021.05.28.13.12.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 May 2021 13:12:19 -0700 (PDT) From: Jarmo Tiitto To: samitolvanen@google.com Cc: wcw@google.com, nathan@kernel.org, ndesaulniers@google.com, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Jarmo Tiitto Subject: [PATCH 6/6] pgo: Fixup code style issues. Date: Fri, 28 May 2021 23:12:13 +0300 Message-Id: <20210528201213.459483-1-jarmo.tiitto@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Jarmo Tiitto --- kernel/pgo/instrument.c | 106 ++++++++++++++++++++-------------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/kernel/pgo/instrument.c b/kernel/pgo/instrument.c index a95c86d668b5..b30104411879 100644 --- a/kernel/pgo/instrument.c +++ b/kernel/pgo/instrument.c @@ -31,7 +31,7 @@ * ensures that we don't try to serialize data that's only partially updated. */ static DEFINE_SPINLOCK(pgo_lock); -static int current_node = 0; +static int current_node; unsigned long prf_lock(void) { @@ -55,58 +55,58 @@ void prf_unlock(unsigned long flags) static struct llvm_prf_value_node *allocate_node(struct llvm_prf_data *p, u32 index, u64 value) { - struct prf_mod_private_data *pmod; - struct llvm_prf_data *start = __llvm_prf_data_start; - struct llvm_prf_data *end = __llvm_prf_data_end; - struct module * mod; - struct llvm_prf_value_node * vnds = __llvm_prf_vnds_start; - struct llvm_prf_value_node * vnds_end = __llvm_prf_vnds_end; - - if(start <= p && p < end) { - /* vmlinux core node */ - if (&vnds[current_node + 1] >= vnds_end) - return NULL; /* Out of nodes */ - - current_node++; - - /* Make sure the node is entirely within the section - */ - if (&vnds[current_node] >= vnds_end || - &vnds[current_node + 1] > vnds_end) - return NULL; - - return &vnds[current_node]; - - } else { - /* maybe an module node - * find in what module section p points into and - * then allocate from that module - */ - rcu_read_lock(); - list_for_each_entry_rcu(pmod,&prf_mod_list,link) { - mod = READ_ONCE(pmod->mod); - if(mod) { - /* get section bounds */ - start = mod->prf_data; - end = mod->prf_data + mod->prf_data_size; - if(start <= p && p < end) - { - vnds = mod->prf_vnds; - vnds_end = mod->prf_vnds + mod->prf_vnds_size; - if (&vnds[pmod->current_node + 1] < vnds_end) { - pmod->current_node++; - - vnds = &vnds[pmod->current_node]; - rcu_read_unlock(); - return vnds; - break; - } - } - } - } - rcu_read_unlock(); - return NULL; /* Out of nodes */ - } + struct prf_mod_private_data *pmod; + struct llvm_prf_data *start = __llvm_prf_data_start; + struct llvm_prf_data *end = __llvm_prf_data_end; + struct module *mod; + struct llvm_prf_value_node *vnds = __llvm_prf_vnds_start; + struct llvm_prf_value_node *vnds_end = __llvm_prf_vnds_end; + + if (start <= p && p < end) { + /* vmlinux core node */ + if (&vnds[current_node + 1] >= vnds_end) + return NULL; /* Out of nodes */ + + current_node++; + + /* Make sure the node is entirely within the section + */ + if (&vnds[current_node] >= vnds_end || + &vnds[current_node + 1] > vnds_end) + return NULL; + + return &vnds[current_node]; + + } else { + /* maybe an module node + * find in what module section p points into and + * then allocate from that module + */ + rcu_read_lock(); + list_for_each_entry_rcu(pmod, &prf_mod_list, link) { + mod = READ_ONCE(pmod->mod); + if (mod) { + /* get section bounds */ + start = mod->prf_data; + end = mod->prf_data + mod->prf_data_size; + + if (start <= p && p < end) { + vnds = mod->prf_vnds; + vnds_end = mod->prf_vnds + mod->prf_vnds_size; + + if (&vnds[pmod->current_node + 1] < vnds_end) { + pmod->current_node++; + + vnds = &vnds[pmod->current_node]; + rcu_read_unlock(); + return vnds; + } + } + } + } + rcu_read_unlock(); + return NULL; /* Out of nodes */ + } } /* -- 2.31.1