Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp97103ybl; Fri, 17 Jan 2020 19:12:18 -0800 (PST) X-Google-Smtp-Source: APXvYqyV6sxTqDciw1FOIHAIrCzOyb6It7w2p7+BG4rUTBvWSUgGUEmYxQwBxaioSVeG8wpjZpvx X-Received: by 2002:a9d:7ccc:: with SMTP id r12mr8813591otn.22.1579317138017; Fri, 17 Jan 2020 19:12:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579317138; cv=none; d=google.com; s=arc-20160816; b=Hohh+68HgAPy3ySAys75y8YdBW5B5TS0lwm/cZZy1eGZYqlLFC6YRvBQOL51o3urQJ v8L1LEG0MgPKPHQeiBxKsf/flTuDt2JTKzlcPykZwuU29+MZEP9Idj+wiu+hPmb4eXA7 Hza6uOECTBVgeuZmh/QsdxUTsB8qrJrEX5Cs1lGANjgsIgKc/iC8VdldqUoLVM8VrITv /MbNQ/3C9slwNRdxgJoK23a1yuATIwX4vBp1obk2d5oTyEwZiMeMVZuVPts8gm74x/m4 AhEJlo6s8ko6kwdwPn6xWVYRxmw+4ZY5fNrry14jf5cStvsoRU4N2DaISYXrsh+oex9D QAVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=kCkFnYkawO75Slclr1NGNbFjc/K/Z8ax1mgdyxXyluc=; b=teOLwl1jMkV3AKWgdeWaY5HrG2mWQDTFWiQqHvpbJzUsUhP5JdfBUsxhYNsgI14srj g7MQ8P+hzNBbFszx9wlkvWTpb+D5VSTI60mnBIaV9lZvvVZC2B5kqPMIGfq9Yc7mdIMj e8uF1jR37FC7w7jrRXtOa6ercWL40topn8yaAGX7PAf1pY+TDIG2almdjkYYBbJowjKF XjyLq09mOAxo1kE1O0VCY9AgFQWqIXl3/K/wkjf0apNr1/zzoiRBIvAQiloPO2AeodVO 4JA4ou+NCCM2q8xa/iWIK7CLYsrKBj4M6O2LatLfyoimnTDS7fbkuD4R6JKVdJQOpdkG MDiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kFFMSn6G; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q2si16657141oti.273.2020.01.17.19.12.05; Fri, 17 Jan 2020 19:12:18 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kFFMSn6G; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730656AbgARDLL (ORCPT + 99 others); Fri, 17 Jan 2020 22:11:11 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:33585 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727033AbgARDLL (ORCPT ); Fri, 17 Jan 2020 22:11:11 -0500 Received: by mail-pl1-f193.google.com with SMTP id ay11so10642966plb.0; Fri, 17 Jan 2020 19:11:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=kCkFnYkawO75Slclr1NGNbFjc/K/Z8ax1mgdyxXyluc=; b=kFFMSn6GQbVrsB7xcz6GHNYsvWVsZtZLtyarkvcW4Qjn8R2Vlklx5fkrNTwwRZulTD Jjnj/FKMP1+IzHx8ruolwTiB6z+Z3Y8NZWo1QTXIis3LaKm2v0/NYOdnner2pO9hrV3U Ock9seKbMjAL63Xn7eeqrCFS6F4e3bYHJIFHESFv0x7zzpG5oh2xf5aR0alR+kcSYnxC LG9Aeugqhvwf/kv2MkGt9FH7Y2RXdgoKAowTagWQUeVtagogRbE2cDQ/xhduU5oOB2Hz CMgcvKpqoCE6iquWtUM+Fqj57BHjyIdrVoGA6eEf5Rud/K6I9FFqrL1asp7kDWRlW57+ 0S7A== 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; bh=kCkFnYkawO75Slclr1NGNbFjc/K/Z8ax1mgdyxXyluc=; b=tNriiQ+07mMGuSyUF0fx0w37zTSkJkcm1GrJHzD+Y6zxRRSPiioxQuyqBinszD9Zas OLwL8ZN1aVVWpYHkYx0xhVaJ3Yl9NdOiHTNj0EVhemEfQgdoc013qhyj8q2a6nAkilzg XXf2NUWktlYFbGhPnqpDMSKQv8keTLvg7R7DKmxS1HPFELRGA4jj7g0kdt1QKCFbm62O Fi2XPA8SYXAwYvTgMSPgoagl6BWLNIiwHQq3nUWWETvYpn7PLx2aFPoYkn33UGmkmm8W 1HfgndZDieQQrRdC1nzHazsj97lDZzMKmMdQqKhLUqSMGsfh4yeQiZK2LUShwN5zOMkW 12iQ== X-Gm-Message-State: APjAAAWKhmhYkbBH2DSXObZCZoGFZPsHvXXkNN8eAj9qf68SHO2ieJc6 rGRGMk4ks7oDxlwroW0HMg== X-Received: by 2002:a17:902:848f:: with SMTP id c15mr2751205plo.182.1579317070565; Fri, 17 Jan 2020 19:11:10 -0800 (PST) Received: from madhuparna-HP-Notebook.nitk.ac.in ([2402:3a80:1ee0:feca:40cf:944c:98dd:69a3]) by smtp.gmail.com with ESMTPSA id g8sm30478701pfh.43.2020.01.17.19.11.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jan 2020 19:11:10 -0800 (PST) From: madhuparnabhowmik10@gmail.com To: tj@kernel.org, lizefan@huawei.com Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, joel@joelfernandes.org, rcu@vger.kernel.org, frextrite@gmail.com, Madhuparna Bhowmik Subject: [PATCH] cgroup.c: Use built-in RCU list checking Date: Sat, 18 Jan 2020 08:40:51 +0530 Message-Id: <20200118031051.28776-1-madhuparnabhowmik10@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Madhuparna Bhowmik list_for_each_entry_rcu has built-in RCU and lock checking. Pass cond argument to list_for_each_entry_rcu() to silence false lockdep warning when CONFIG_PROVE_RCU_LIST is enabled by default. Even though the function css_next_child() already checks if cgroup_mutex or rcu_read_lock() is held using cgroup_assert_mutex_or_rcu_locked(), there is a need to pass cond to list_for_each_entry_rcu() to avoid false positive lockdep warning. Signed-off-by: Madhuparna Bhowmik --- kernel/cgroup/cgroup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 735af8f15f95..c2959764ad95 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -4152,7 +4152,8 @@ struct cgroup_subsys_state *css_next_child(struct cgroup_subsys_state *pos, } else if (likely(!(pos->flags & CSS_RELEASED))) { next = list_entry_rcu(pos->sibling.next, struct cgroup_subsys_state, sibling); } else { - list_for_each_entry_rcu(next, &parent->children, sibling) + list_for_each_entry_rcu(next, &parent->children, sibling, + lockdep_is_held(&cgroup_mutex)) if (next->serial_nr > pos->serial_nr) break; } -- 2.17.1