Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2104019ybt; Fri, 3 Jul 2020 00:31:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQmtVOLmVDfoIYXg0UamTqOqwPzegMZ9B3xVv212Sta2hRQXisSvh9ad6751JV9VXkJDsH X-Received: by 2002:a17:906:7212:: with SMTP id m18mr30829221ejk.29.1593761498994; Fri, 03 Jul 2020 00:31:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593761498; cv=none; d=google.com; s=arc-20160816; b=CrKyuLNd6MgnISGxkvfCWg1Urgb1Obw/xymCnD8geoDS5p6m8q5HNRsHzkMuvmaaUp 5SkhCUYQ8ic80IoRItX8iuuODRSwCnhFIYhrHzW6Dxp3UJ082vGOkHHBYgCRWatGTsFz optYGmtlimfMJsNDJ5ygvf9SldAjRRayH9bro5lzzsj9Kba0qvfAjy4X2WFe3Ov1ofB7 Wrprs+EQQolb0qOYrb2k32BwPJrWX7rlqPxF2KHWk2mmHzly/G/xEJOa3CHNPWeDZr9v 3+iTxGqVcAaC7gKJrodsWxiwT4PQE+zi8MxXmooeocyv++sx7nlmGAB4u8rW0nCOdrqy TG0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=4i8GSGzkbrrB5YdtMUJ8Q1T05FGe9abxFAVFwvWl95E=; b=b24SQQNdzx4PFmY7Q1ITLbjre8xc5fVLbxB6jTIO2vdfsraBP6s3Xr04oJa4lqdzFW XlnesKkB0zOr80MqjDrcpYsHkghmFZXBX+1TgHORVXO3K8wUugZsn9YCQgvcvJV4VGnT cXnE61PizwvoAGTdk0wmLV6MdaesQtUQ8aOMKiJg08eKJZFWSBZcvJYBtipNvuAoCuFn EfBV/YoPFVe6X+JOPuTHkxHmX+Fj0/cK3XTtxkM9NzmRKyn0X78kJDIV8a3UQE4AjgOL hjmvg/szNrBtgz/g0qybxqHebRvGNLWdZ54r1CJzJZX+PC2fdP/wD+8exNvYEBYu73jI pKSw== ARC-Authentication-Results: i=1; mx.google.com; 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 a16si7597346ejk.194.2020.07.03.00.31.14; Fri, 03 Jul 2020 00:31:38 -0700 (PDT) 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; 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 S1726035AbgGCH2U (ORCPT + 99 others); Fri, 3 Jul 2020 03:28:20 -0400 Received: from mx2.suse.de ([195.135.220.15]:47144 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725779AbgGCH2U (ORCPT ); Fri, 3 Jul 2020 03:28:20 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id E160CAF43; Fri, 3 Jul 2020 07:28:18 +0000 (UTC) Date: Fri, 3 Jul 2020 09:28:18 +0200 From: Petr Mladek To: qiang.zhang@windriver.com Cc: ben.dooks@codethink.co.uk, bfields@redhat.com, cl@rock-chips.com, peterz@infradead.org, tj@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] kthread: Don't cancel a work that is being cancelled Message-ID: <20200703072818.GC11587@alley> References: <20200702044324.32927-1-qiang.zhang@windriver.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200702044324.32927-1-qiang.zhang@windriver.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 2020-07-02 12:43:24, qiang.zhang@windriver.com wrote: > From: Zhang Qiang > > When canceling a work, if it is found that the work is in > the cancelling state, we should directly exit the cancelled > operation. No, the function guarantees that the work is not longer running when it returns. This is why it has the suffix "_sync" in the name. We would need to add kthread_cancel_work() without the "_sync" wrappers that would not wait for the work in progress. But it might be dangerous. The API users usually want to make sure that the work in not longer running to avoid races. What is the use case for the non-sync behavior, please? Best Regards, Petr