Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp1545978img; Tue, 19 Mar 2019 09:55:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqw9vTljRoAQPfxQ9i2d8Tac75rRqIfn13HvRc2oS8lng+vx5vcvgwriS8QhdvhW7FNAfT8P X-Received: by 2002:a63:fd07:: with SMTP id d7mr2718816pgh.199.1553014539072; Tue, 19 Mar 2019 09:55:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553014539; cv=none; d=google.com; s=arc-20160816; b=O1by462aVyLn8oJvBKg+NiUh9RFWNouveFMceE7v0SmWS9Nu3j+tnXIqOx5NUXXADV 2kWS5o3C9LKFOJksIXliN0YISWw01joqQWjtMgmyu4QIBZSZTaaXEVQlN3vFn8XRFCQ4 Jkltn5xNbP+8eUrdJ+ficQXUoJ0uk3Y8CYFcCxH7PabRSUjmNRqX/UZmuCqTOOa/7u0E hCDO46zS5/ScHs6YZQxj9tv/11nzx9Hkti8r7vQKITauLB2r6Ac2De3TBviNjuDH913S Y8QsJ2bMifDQc2hyTdS2A/ClT8WR3gscSkOoQnTG76YlBnzs5NzapUWCu878U9LzWsWn sHng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=cPpnKvD04a+mp4/kzQvCt9DyBkyCzpLrTMG/0bW8btg=; b=Yd2Lj2CXgZCt4DXDXzaV02hU7TZ7zNMyqib/hpKF8734Txx7ujYv86UyIj5qfJXKbG LmNgJpKkubGq4yod9qQZDpnh43gnF0UdRA1QX8gpzVsoRt2KNE8qWUj6OYeW+7grno5o CJG7f/SQ3Ih0rdSezP/3DmR7uHUHToOBfipsqLywDh89fd8vKCMgr4GZedyna72+mW1t v3t7Hjkm8QVugnif/SbfltkIwzjxIbzAVFjcHhIw7n+Cz+2hv9MeDp9tWPoUVmQC0gn0 EYeApZdPeDLsQJMXCfoM6JEaC+Og2toJ/ezUHfDuGvqzLwmRBXlCmQoOHnfgGB4fvrOB cb5Q== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g98si12643890plb.11.2019.03.19.09.55.23; Tue, 19 Mar 2019 09:55:39 -0700 (PDT) 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 S1727553AbfCSQyr (ORCPT + 99 others); Tue, 19 Mar 2019 12:54:47 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:45628 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727236AbfCSQyr (ORCPT ); Tue, 19 Mar 2019 12:54:47 -0400 Received: by mail-pg1-f193.google.com with SMTP id y3so5032537pgk.12 for ; Tue, 19 Mar 2019 09:54:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=cPpnKvD04a+mp4/kzQvCt9DyBkyCzpLrTMG/0bW8btg=; b=XfiVPUaa7p9zHuJTt7qsIO/cNMvVqHWqccc3ApZKHVyXvmRE3P88v1GgL4MHhHeORR /ixrA2k4TsxFmpJEn0zSCBkFQKUiSloRS6Sse0ycT1+W03RemlLIirTA6e4SwrCGY9SR ZWGUizN4QaHU89UizctuaIGvPZ+CS3Ug01UVxQC9JpSx+Ayal3EoTlIqQQfbYeG5i4+O rhORLwS3XgEPdpn5ysXFtaywzWj9oRP/o+HqPkZVjhgwwYCx4GQYcHSzmem0P2OU9whh CneXLJRfFYFx4EUWq3uy8Oq/g0FDut0XIRDGVFcyzDQxuc3w0CgpvAv1XkpSu5B0+4cZ WtrA== X-Gm-Message-State: APjAAAU8MLbLd8qfRoMOzDoiPIK7+Mlwdkz056+SE+Pipepu1OaKu7Wa +bx6Ob/PfMBRkln6KOgg5X3UJRcmp9s= X-Received: by 2002:a17:902:8ec1:: with SMTP id x1mr26968281plo.52.1553014486387; Tue, 19 Mar 2019 09:54:46 -0700 (PDT) Received: from ?IPv6:2620:15c:2cd:203:5cdc:422c:7b28:ebb5? ([2620:15c:2cd:203:5cdc:422c:7b28:ebb5]) by smtp.gmail.com with ESMTPSA id j20sm8396340pff.22.2019.03.19.09.54.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Mar 2019 09:54:45 -0700 (PDT) Message-ID: <1553014484.65329.10.camel@acm.org> Subject: Re: [PATCH v2 15/19] locking/lockdep: Remove __cq_empty() From: Bart Van Assche To: Yuyang Du , peterz@infradead.org, will.deacon@arm.com, mingo@kernel.org Cc: ming.lei@redhat.com, linux-kernel@vger.kernel.org Date: Tue, 19 Mar 2019 09:54:44 -0700 In-Reply-To: <20190318085733.3143-16-duyuyang@gmail.com> References: <20190318085733.3143-1-duyuyang@gmail.com> <20190318085733.3143-16-duyuyang@gmail.com> Content-Type: text/plain; charset="UTF-7" X-Mailer: Evolution 3.26.2-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2019-03-18 at 16:57 +-0800, Yuyang Du wrote: +AD4 +AF8AXw-cq+AF8-empty() can be embeded in +AF8AXw-cq+AF8-dequeue(), removing it. We get slightly +AD4 simpler code. No functional change. Does inlining +AF8AXw-cq+AF8-empty() really improve readability of the lockdep code? +AD4 -static inline int +AF8AXw-cq+AF8-dequeue(struct circular+AF8-queue +ACo-cq, struct lock+AF8-list +ACoAKg-elem) +AD4 +-/+ACo +AD4 +- +ACo Dequeue an element from the circular+AF8-queue, return the lock if the queue +AD4 +- +ACo is not empty, or NULL if otherwise +AD4 +- +ACo-/ +AD4 +-static inline struct lock+AF8-list +ACo +AF8AXw-cq+AF8-dequeue(struct circular+AF8-queue +ACo-cq) +AD4 +AHs +AD4 - if (+AF8AXw-cq+AF8-empty(cq)) +AD4 - return -1+ADs +AD4 +- struct lock+AF8-list +ACo lock+ADs +AD4 +AD4 - +ACo-elem +AD0 cq-+AD4-element+AFs-cq-+AD4-front+AF0AOw +AD4 +- /+ACo +AD4 +- +ACo Is the circular+AF8-queue empty? +AD4 +- +ACo-/ +AD4 +- if (cq-+AD4-front +AD0APQ cq-+AD4-rear) +AD4 +- return NULL+ADs +AD4 +- +AD4 +- lock +AD0 cq-+AD4-element+AFs-cq-+AD4-front+AF0AOw +AD4 cq-+AD4-front +AD0 (cq-+AD4-front +- 1) +ACY CQ+AF8-MASK+ADs +AD4 - return 0+ADs +AD4 +- +AD4 +- return lock+ADs +AD4 +AH0 +AD4 +AD4 static inline unsigned int +AF8AXw-cq+AF8-get+AF8-elem+AF8-count(struct circular+AF8-queue +ACo-cq) +AD4 +AEAAQA -1376,6 +-1381,7 +AEAAQA static int +AF8AXw-bfs(struct lock+AF8-list +ACo-source+AF8-entry, +AD4 int forward) +AD4 +AHs +AD4 struct lock+AF8-list +ACo-entry+ADs +AD4 +- struct lock+AF8-list +ACo-lock+ADs +AD4 struct list+AF8-head +ACo-head+ADs +AD4 struct circular+AF8-queue +ACo-cq +AD0 +ACY-lock+AF8-cq+ADs +AD4 int ret +AD0 1+ADs +AD4 +AEAAQA -1397,10 +-1403,7 +AEAAQA static int +AF8AXw-bfs(struct lock+AF8-list +ACo-source+AF8-entry, +AD4 +AF8AXw-cq+AF8-init(cq)+ADs +AD4 +AF8AXw-cq+AF8-enqueue(cq, source+AF8-entry)+ADs +AD4 +AD4 - while (+ACEAXwBf-cq+AF8-empty(cq)) +AHs +AD4 - struct lock+AF8-list +ACo-lock+ADs +AD4 - +AD4 - +AF8AXw-cq+AF8-dequeue(cq, +ACY-lock)+ADs +AD4 +- while ((lock +AD0 +AF8AXw-cq+AF8-dequeue(cq))) +AHs +AD4 +AD4 if (+ACE-lock-+AD4-class) +AHs +AD4 ret +AD0 -2+ADs This is the most important change in this patch. Using the title +ACI-Remove +AF8AXw-cq+AF8-empty()+ACI for this patch is misleading because the above patch does something else, namely changing the return type of +AF8AXw-cq+AF8-dequeue() from int into a pointer. Should this patch perhaps be split or should the +AF8AXw-cq+AF8-empty() removal be left out from this patch? Bart.