Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5556399pxb; Tue, 16 Feb 2021 01:18:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJxBvitfBTW1kj+b9a4Uk6JFNmqr/X25IY7vLnbMdoxdhMuiAsaFLINSmHq1Z93hzgldy7a9 X-Received: by 2002:a17:906:3285:: with SMTP id 5mr19831308ejw.356.1613467090606; Tue, 16 Feb 2021 01:18:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613467090; cv=none; d=google.com; s=arc-20160816; b=dgAfPLOAGGgD20/AwWv+d2Xj7MuEjvSwGpRiaCMCGIM+kCYeIS/Xpmjd32cNrP5F58 ae0ouCrIq5ZGY0vyijVFTjqYmdbi2ja877pVSbMGJXb870FZFCjC3ChxTwCB8Qaze4wU h8g3BaclrEB2SsEtD67xy2cK6EKXVsTB4BgF5tOXZoMLBQH+eg4YsZYOQY9sgJ3ANCXG hLB90jA5FBQ+47pdc5gPGajRW9TCtsxFynEnBE6Hm4L7UzzQ8AFaGXi+2uX8Q/SK/UJp 5QH9c4twWeJUW+/QuwPfit+9bDhOxDAsfB94OWU+f59t0iyBfqgl9qhxx3tVXkt8z96C GINQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=RYyCsWjbE6xvbt/JL7kqtzZn8Gk0jXO1Dg9iiqvMK0Q=; b=TlpkYlD/uqIPhbR3muCkuaXrEqKLEBV8WxLEyZ8+5mJ5Rnl9teJDl4uInP0xGSmt2+ nsseGixM94qK066SffY+eaOgyF7ng7eb0qRLIj2e+zxQV8yEG0/9Xl9xDS8UE9gC1AE9 4EIm39rexHP/Qop6E6jI9v+gA+kIFHAS7z6001bMmfAutmSYRslG/7tFsLi9Tc+w4T2g 9Nwhdq7xJuowAB2yWckCZpUwmBPTJtDbICPDKvdG+3YrIkP3xDp2LXJ1uyTb0Y9uvyy8 zGY+VJgfet4W8fQr6ula1Az2+/D15DhI28ycJK/7yJPfB7lCKTFGF3dAOfUihaGN4JfJ tqRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=HuPLkGFz; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w16si13999688edi.602.2021.02.16.01.17.46; Tue, 16 Feb 2021 01:18:10 -0800 (PST) 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=@infradead.org header.s=casper.20170209 header.b=HuPLkGFz; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229925AbhBPJPB (ORCPT + 99 others); Tue, 16 Feb 2021 04:15:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229895AbhBPJOG (ORCPT ); Tue, 16 Feb 2021 04:14:06 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C9C2C061756 for ; Tue, 16 Feb 2021 01:13:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=RYyCsWjbE6xvbt/JL7kqtzZn8Gk0jXO1Dg9iiqvMK0Q=; b=HuPLkGFzr1Lu88Wta2oiCqzxfk twLUbjLjHQ9/T5U233NZLyk7UM/hplXuL/k7SZ6g9bpJkahnUsnO36EMTDJiz4hwDR9zTpCaQKHke +FV3aTHKF2f1A9R4+mSIO0OUHd3uHgL/iDuFlVxZ0khkMJ+1hbnoq4THvybHfMOotKugsXMRrG8n1 3f9A5fRdjXHA2oW8iazQM3xQ10CGGcTJGXZ46QjizOs8W/MeQ74hVm+QVyfSJIPfVL7+kSFmBVTRu xV5i9a9S0gwnVo7h3Q7o1/5UqXVczmcECGJRJTlmTFumn7lG65gYndyzrrOsnRBsbu8IhPYaifpXK mfkgaANw==; Received: from hch by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lBwOG-00GgRK-2C; Tue, 16 Feb 2021 09:11:40 +0000 Date: Tue, 16 Feb 2021 09:11:28 +0000 From: Christoph Hellwig To: Yiwei Zhang Cc: Andrew Morton , Felix Kuehling , Jens Axboe , Petr Mladek , "J. Bruce Fields" , Peter Zijlstra , Frederic Weisbecker , Marcelo Tosatti , Ilias Stamatis , Rob Clark , Mathieu Desnoyers , Liang Chen , linux-kernel@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH] kthread: add kthread_mod_pending_delayed_work api Message-ID: <20210216091128.GA3973504@infradead.org> References: <20210214000611.2169820-1-zzyiwei@android.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210214000611.2169820-1-zzyiwei@android.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Feb 14, 2021 at 12:06:11AM +0000, Yiwei Zhang wrote: > The existing kthread_mod_delayed_work api will queue a new work if > failing to cancel the current work due to no longer being pending. > However, there's a case that the same work can be enqueued from both > an async request and a delayed work, and a racing could happen if the > async request comes right after the timeout delayed work gets scheduled, > because the clean up work may not be safe to run twice. Who is going to use this? Please submit it together with the actual user.