From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82698C433F5 for ; Fri, 8 Apr 2022 04:16:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 11D9A8D0001; Fri, 8 Apr 2022 00:16:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0CE216B0075; Fri, 8 Apr 2022 00:16:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ED7588D0001; Fri, 8 Apr 2022 00:16:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id DEDC56B0074 for ; Fri, 8 Apr 2022 00:16:56 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id A154D25231 for ; Fri, 8 Apr 2022 04:16:56 +0000 (UTC) X-FDA: 79332401232.19.869DC48 Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) by imf07.hostedemail.com (Postfix) with ESMTP id AC64A40003 for ; Fri, 8 Apr 2022 04:16:55 +0000 (UTC) Received: by mail-pg1-f173.google.com with SMTP id h5so5803539pgc.7 for ; Thu, 07 Apr 2022 21:16:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language :from:to:cc:references:in-reply-to:content-transfer-encoding; bh=ahIvTqLjbXRzNKd9L9AZ6yqiUOeFsB+LyTwpIETN3bw=; b=ydNJB3c7gF/8QAKJJITL+Pw+A+Gzh3b8MGAy4GcKtMXy+rimoOfva+sGxfzfS9vCWj mNik6sB/prq6r8a+UJ4xypTN6Po558fMa6L7vHtqC4CAgPqCb68elKST/vkCO6JhmyQ2 5UsLTcF0cjGcxCST4DGimacF0cINev1hdGGeElChQDN3RR9bCoCjqFWhAXpX+Po43xKv a6kr1sZ0B70ECX8U14brDt5jRJzIgCewMp6RwNg0YcIp/YsLaITnkwKCiFE6rTCEwpYc YhXXxdzG77PQptmFcjK2lcJDpflxgU0FWZsmeo1mEnPyzOufDrWmfwc4F439OQVuNhee KObQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:from:to:cc:references:in-reply-to :content-transfer-encoding; bh=ahIvTqLjbXRzNKd9L9AZ6yqiUOeFsB+LyTwpIETN3bw=; b=DtoIDA0HDZhnGXkFmBcgXlM1Epwagwnnl3AxO9k9Xz6rYlousx+eaxy1pEmxxni6U5 AHoR5YdG/u/S08UuWFThwzqZYEM4i1WDbZl9WfWmm01rfXkCee5E5j68nQo3hdZShLs4 LGfqKAp+QYJ1RDkU9Hq/DcHfj7RrZctHaZzPytXzs+ndKtFBdF+HG96Dg7TZJXvHXcpq ITiLzbos6FL6IqktmQllzpABthYBBWN0f3C3bs4cgML4DIZAARr6bhMXQroEepE85h9a bGrsM/0DwHEAKCKCR8mpccJg8Id4gaBBKQWkiknUdxQ3gzyXGE/g1MGOjJdRCqcprYep O1Lw== X-Gm-Message-State: AOAM533YfocZL3uqEINAnSZy3QbEFBXKpUVeGOXbe/ETw5SYpJ7mS/Ut Heumxe88an9JOvH7gjiXpj/w0A== X-Google-Smtp-Source: ABdhPJw5K0e+ahOciFMUsq3B9hVA92+60mfnczGabrxHa6jm6hQ7AyHeQ0w/K3tWgCi1GpIguHgxNQ== X-Received: by 2002:a63:af47:0:b0:398:4be1:ce1d with SMTP id s7-20020a63af47000000b003984be1ce1dmr14021742pgo.514.1649391414251; Thu, 07 Apr 2022 21:16:54 -0700 (PDT) Received: from [10.255.182.146] ([139.177.225.255]) by smtp.gmail.com with ESMTPSA id v24-20020a634818000000b0036407db4728sm20072849pga.26.2022.04.07.21.16.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 Apr 2022 21:16:53 -0700 (PDT) Message-ID: <60c4b8a3-e526-d51e-c880-cd14ce23d718@bytedance.com> Date: Fri, 8 Apr 2022 12:16:49 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH] percpu_ref: call wake_up_all() after percpu_ref_put() completes Content-Language: en-US From: Qi Zheng To: Andrew Morton Cc: Muchun Song , dennis@kernel.org, tj@kernel.org, cl@linux.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, zhouchengming@bytedance.com References: <20220407103335.36885-1-zhengqi.arch@bytedance.com> <20220407205419.f656419a8f4665a2dc781133@linux-foundation.org> <35195a61-d531-aeb2-5565-146e345f8bf6@bytedance.com> <20220407211018.875696691e4411a7b5c8f63f@linux-foundation.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Stat-Signature: kb519dhfs9phib4mfkmsuj13tpmke1uq Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=ydNJB3c7; spf=pass (imf07.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.215.173 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: AC64A40003 X-HE-Tag: 1649391415-236173 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000003, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 2022/4/8 12:14 PM, Qi Zheng wrote: > > > On 2022/4/8 12:10 PM, Andrew Morton wrote: >> On Fri, 8 Apr 2022 12:06:20 +0800 Qi Zheng >> wrote: >> >>> >>> >>>>>>> Signed-off-by: Qi Zheng >>>>>> >>>>>> Are any users affected by this?  If so, I think a Fixes tag >>>>>> is necessary. >>>>> >>>>> Looks all current users(blk_pre_runtime_suspend() and >>>>> set_in_sync()) are >>>>> affected by this. >>>>> >>>>> I see that this patch has been merged into the mm tree, can Andrew >>>>> help >>>>> me add the following Fixes tag? >>>> >>>> Andrew is helpful ;) >>>> >>>> Do you see reasons why we should backport this into -stable trees? >>>> It's 8 years old, so my uninformed guess is "no"? >>> >>> Hmm, although the commit 490c79a65708 add wake_up_all(), it is no >>> problem for the usage at that time, maybe the correct Fixes tag is the >>> following: >>> >>> Fixes: 210f7cdcf088 ("percpu-refcount: support synchronous switch to >>> atomic mode.") >>> >>> But in fact, there is no problem with it, but all current users expect >>> the refcount is stable after percpu_ref_switch_to_atomic_sync() returns. >>> >>> I have no idea as which Fixes tag to add. >> >> Well the solution to that problem is to add cc:stable and let Greg >> figure it out ;) >> >> The more serious question is "should we backport this".  What is the >> end-user-visible impact of the bug?  Do our users need the fix or not? > > The impact on the current user is that it is possible to miss an > opportunity to reach 0 due to the case B in the commit message: There may be performance issues, but should not cause serious bugs. > > /* The value of &ref is unstable! */ > percpu_ref_is_zero(&ref) >                         (B)percpu_ref_put(ref); > > Thanks, > Qi > >> > -- Thanks, Qi