From patchwork Fri Jan 26 16:00:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 125997 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp434400ljd; Fri, 26 Jan 2018 08:02:02 -0800 (PST) X-Google-Smtp-Source: AH8x2274m2LBKmXp1OWSIk3hZkR8fQU0KMQQbvar0jCkHN4lXyWq9d5edEs5WWUGSrq5g0EOI9ir X-Received: by 10.55.51.18 with SMTP id z18mr21340362qkz.103.1516982522580; Fri, 26 Jan 2018 08:02:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516982522; cv=none; d=google.com; s=arc-20160816; b=HTwy2EaPGWQR8DG5/LYzkFLl96M2ecYhHVXlFB7mke7y92Bry1kR7WWHPjlg+yqHae ndy/Aq4nqzK2waYRcE7D2GPeigNAuYe1s7kiMqvdV1A0PzlQ5NyBLJb6FHwtQgv5V+YS 7qq1k3B6Q7bXYaF2AFh5ctSA1XF3nrUryqERO+tYeL02SGsh8LOKCEszSJZA4+EdWm8a MH7JFutDC4H3mrpIFK/rj5QnOxiDSQkQbMuDSoKjujYEuEvkndaqWbksMvLpsL9cnMPi cb7WKEeotNx91SuZaCbOeOeuO1hNDPBuen5j2kxdZtmHCvTycunV0LHPzr7cqBRuAuQk PNRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=WA/sxVxwWXF06gfKeKpOrn0kyM5aprbRFNNx+Gf+daw=; b=dyK/DY8PeD9RjCF0vb52kUR/MWLUBgb58rsJANzWOMxU7gjugM65155bXjRZjnC2qm lR6tceew1nMr+4AGjGanPIuMrZeUzuOBn3WRF0MYJBOl/ddTDmnWqxsBMiEIy8Ia/+EX 0jY9ZBENTtW/muNCQL/HP3Hw+8O6d1oX6+emfVOLi8iTySWIAO7HezBgUeTa8UVfuNlB 6FWFwV7J6fl7sMlHpsx0xJXkNOVXAnBPphrQc8Bx2iG5bK5tzplTc+cfd0GFWc4pM5YL +8XceFSZTcLytl6H3oOJ8pko0irjMH03lWO4B0RZ3Ue4WQ6YZUmD8QxI3uG5pUIglNTn ZgfA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id y37si5781073qty.45.2018.01.26.08.02.02; Fri, 26 Jan 2018 08:02:02 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 46C37617B3; Fri, 26 Jan 2018 16:02:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id AF4B261701; Fri, 26 Jan 2018 16:00:28 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 0266A61764; Fri, 26 Jan 2018 16:00:18 +0000 (UTC) Received: from forward102o.mail.yandex.net (forward102o.mail.yandex.net [37.140.190.182]) by lists.linaro.org (Postfix) with ESMTPS id 3C3E0616F5 for ; Fri, 26 Jan 2018 16:00:12 +0000 (UTC) Received: from mxback13j.mail.yandex.net (mxback13j.mail.yandex.net [IPv6:2a02:6b8:0:1619::88]) by forward102o.mail.yandex.net (Yandex) with ESMTP id 70DE15A026F6 for ; Fri, 26 Jan 2018 19:00:10 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback13j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id PHyPY5XkS6-0AqiiKp7; Fri, 26 Jan 2018 19:00:10 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id DoB1D1wBxs-09FKIMAg; Fri, 26 Jan 2018 19:00:09 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Fri, 26 Jan 2018 19:00:07 +0300 Message-Id: <1516982407-9893-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516982407-9893-1-git-send-email-odpbot@yandex.ru> References: <1516982407-9893-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 433 Subject: [lng-odp] [PATCH v1 2/2] linux-gen: locks: use inlined thread id X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Use internally always the inlined version of thread id function. Signed-off-by: Petri Savolainen --- /** Email created from pull request 433 (psavol:master-thread-inline) ** https://github.com/Linaro/odp/pull/433 ** Patch: https://github.com/Linaro/odp/pull/433.patch ** Base sha: 6be7adab1a16a62e871bc4ed4f3c926645b2ecd0 ** Merge commit sha: 81e939496b96b0bf1c85e197d4aa70c21870ecf7 **/ platform/linux-generic/odp_rwlock_recursive.c | 11 ++++++----- platform/linux-generic/odp_spinlock_recursive.c | 7 ++++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/platform/linux-generic/odp_rwlock_recursive.c b/platform/linux-generic/odp_rwlock_recursive.c index 1f93df35d..d484ba5ae 100644 --- a/platform/linux-generic/odp_rwlock_recursive.c +++ b/platform/linux-generic/odp_rwlock_recursive.c @@ -8,6 +8,7 @@ #include #include +#include #include #define NO_OWNER (-1) @@ -22,7 +23,7 @@ void odp_rwlock_recursive_init(odp_rwlock_recursive_t *rlock) /* Multiple readers can recurse the lock concurrently */ void odp_rwlock_recursive_read_lock(odp_rwlock_recursive_t *rlock) { - int thr = odp_thread_id(); + int thr = _odp_thread_id(); if (rlock->rd_cnt[thr]) { rlock->rd_cnt[thr]++; @@ -36,7 +37,7 @@ void odp_rwlock_recursive_read_lock(odp_rwlock_recursive_t *rlock) /* Multiple readers can recurse the lock concurrently */ int odp_rwlock_recursive_read_trylock(odp_rwlock_recursive_t *rlock) { - int thr = odp_thread_id(); + int thr = _odp_thread_id(); if (rlock->rd_cnt[thr]) { rlock->rd_cnt[thr]++; @@ -53,7 +54,7 @@ int odp_rwlock_recursive_read_trylock(odp_rwlock_recursive_t *rlock) void odp_rwlock_recursive_read_unlock(odp_rwlock_recursive_t *rlock) { - int thr = odp_thread_id(); + int thr = _odp_thread_id(); rlock->rd_cnt[thr]--; @@ -66,7 +67,7 @@ void odp_rwlock_recursive_read_unlock(odp_rwlock_recursive_t *rlock) /* Only one writer can recurse the lock */ void odp_rwlock_recursive_write_lock(odp_rwlock_recursive_t *rlock) { - int thr = odp_thread_id(); + int thr = _odp_thread_id(); if (rlock->wr_owner == thr) { rlock->wr_cnt++; @@ -81,7 +82,7 @@ void odp_rwlock_recursive_write_lock(odp_rwlock_recursive_t *rlock) /* Only one writer can recurse the lock */ int odp_rwlock_recursive_write_trylock(odp_rwlock_recursive_t *rlock) { - int thr = odp_thread_id(); + int thr = _odp_thread_id(); if (rlock->wr_owner == thr) { rlock->wr_cnt++; diff --git a/platform/linux-generic/odp_spinlock_recursive.c b/platform/linux-generic/odp_spinlock_recursive.c index 5293c04b1..d6d914201 100644 --- a/platform/linux-generic/odp_spinlock_recursive.c +++ b/platform/linux-generic/odp_spinlock_recursive.c @@ -8,6 +8,7 @@ #include #include +#include #define NO_OWNER (-1) @@ -20,7 +21,7 @@ void odp_spinlock_recursive_init(odp_spinlock_recursive_t *rlock) void odp_spinlock_recursive_lock(odp_spinlock_recursive_t *rlock) { - int thr = odp_thread_id(); + int thr = _odp_thread_id(); if (rlock->owner == thr) { rlock->cnt++; @@ -34,7 +35,7 @@ void odp_spinlock_recursive_lock(odp_spinlock_recursive_t *rlock) int odp_spinlock_recursive_trylock(odp_spinlock_recursive_t *rlock) { - int thr = odp_thread_id(); + int thr = _odp_thread_id(); if (rlock->owner == thr) { rlock->cnt++; @@ -63,7 +64,7 @@ void odp_spinlock_recursive_unlock(odp_spinlock_recursive_t *rlock) int odp_spinlock_recursive_is_locked(odp_spinlock_recursive_t *rlock) { - int thr = odp_thread_id(); + int thr = _odp_thread_id(); if (rlock->owner == thr) return 1;