Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp21224pxb; Tue, 23 Feb 2021 16:47:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJz8O5sThrItfKGSn6ANRmPkO90Oe2fKPzzkeAmDy2DD8apV+p/OEHr74cpnAzZmXtBi4VBv X-Received: by 2002:a17:906:3285:: with SMTP id 5mr29450321ejw.356.1614127636073; Tue, 23 Feb 2021 16:47:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614127636; cv=none; d=google.com; s=arc-20160816; b=zXMmoJ5Li/k3p82CaS1xgcLTaE9DK3To+zonEcyZ2S+woEGft1qXOePhUKDz5V2uQb 5W+7dBVLgFPgWVc1/M66dkqQmFarZCJa1c7azK88zbbx0CcJ2N8iQ50S5iRi0h4k1eMt E7+JPTJNLYo9MOsV3XWwr6uTfiz1Ml+1+/GtUbfc8LoWT4YqQvOBmosTO+/XcqFjnJ+G ZE/r1ZYK89bX21PKG8CpSIlE4R9MIh8qZvc1PtpAW15TtFJU6RgZ74xw3hf9+9I36Hwe xYG3BvYJgbSXEXB2M2dlr+a7rY5GnXV9ashV2arE/3B9PPR4/3VIagOXgtKBMjclTr/d a2Lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Bf1CiVTxRiLHc6u9dFffl/B6A9OxU94+5fQMt8aSHiQ=; b=HlFmxgFYSRFRMiNLO2sVEkoRyDCKXXM3F9a7gnNqEza79Mx2BahJpgjOs6FgH0+14M kbayalM7r3AXc6U+G7Ss5QjdevHkRxS4QcICSNgPVCDwmC4uORx/YsKZi503eLw0majE bDuenbEhtsHXiZ/EJ8fZmJIefBJskv+pFXYWNiVKlmOjwZTTZsvqvassCgeSIV+aO3Cz TMp91zBaBAO/lvY56FrtFN6737u+cEcqWXpujBCK78ydQpPGngWd0zY++FA1s4HShene 5FN7jyEfjyKYqw/T49O13s54w2+9ryz3RmUbdNexzMqoZZ7vdJ0XR3LIgeHCgU7fgBGn dqbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b=j3YLbAkk; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=android.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a70si105372edf.383.2021.02.23.16.45.24; Tue, 23 Feb 2021 16:47:16 -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=@android.com header.s=20161025 header.b=j3YLbAkk; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=android.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232383AbhBWWkl (ORCPT + 99 others); Tue, 23 Feb 2021 17:40:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231969AbhBWWa3 (ORCPT ); Tue, 23 Feb 2021 17:30:29 -0500 Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0F09C061574 for ; Tue, 23 Feb 2021 14:29:48 -0800 (PST) Received: by mail-qk1-x730.google.com with SMTP id 81so389520qkf.4 for ; Tue, 23 Feb 2021 14:29:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=android.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Bf1CiVTxRiLHc6u9dFffl/B6A9OxU94+5fQMt8aSHiQ=; b=j3YLbAkkeUM4k5JUJuv1ncXjfeJBhF70Wu+WevNquAGfKJ4iXi+pkO61TOe8ZU/Jq0 BRsdPJowgYj2pcym8gfG0ajJAov8g47YZZX6aCJ4Y+Xw2lPRY1IbyhJUPoxqy7dh0u/v hmeCrTUZeIp8Q4kGCE1RyugQJXRRJMkRe10grOAEC4TbM4u1wBUThjSX+deBkv7+CDHG LOo4orQdUjhp3vm5CvLaVx10rwvtI5aJjfpN2iAHCVqEPk5ucpjVuUcdJylQgAba/Rjl TvGi/G/ks9UTRk69ghxZS6J1y3Jf/uFurAxVYc82T0+zj/ZbDqZYPdU+59VmV9V3IH/M uDJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Bf1CiVTxRiLHc6u9dFffl/B6A9OxU94+5fQMt8aSHiQ=; b=bahNIdnoQO3CiFOvoU5KlkPrWL1aH5vFZxMfPyvrv/GfLGtG1fM7CQM2CkiCZeN/+/ 8JaOXPJcBPRxLcRVXmckbXVN3XAnROBCB+mxtrOM9Z8PucUQnPHzCFLt8cfoWO46dcyl NFZM5iaXbrGHlhQfbbm+AQOeDFEEvqz0uIfGl3IXF3fIbIPLzQzL/O84+p2eVZLIAQdD DfQOcGdeslX/RXMT5/8KLznDitg717Gs2s4GW37ZtW29RJsSyOpE4qkXTxjlDPE+ozwS PfLkCHm++Kd0yOyKh1u9000KyTcpu8fCSyRq/oac9huJeJ/CuIUV8qC18YuVPpzWPnE5 ZgmA== X-Gm-Message-State: AOAM533SKY6KwfTC5we4SB6Gn8xAmcrixXvGdGpZN3vPLkZHgE0cYTn4 5otoiVA5DKDxPsb3HP98rU0tdUN0Gax3Pv1xjD6M1g== X-Received: by 2002:a05:620a:237:: with SMTP id u23mr27678392qkm.229.1614119388270; Tue, 23 Feb 2021 14:29:48 -0800 (PST) MIME-Version: 1.0 References: <20210214000611.2169820-1-zzyiwei@android.com> In-Reply-To: From: =?UTF-8?B?WWl3ZWkgWmhhbmfigI4=?= Date: Tue, 23 Feb 2021 14:29:37 -0800 Message-ID: Subject: Re: [PATCH] kthread: add kthread_mod_pending_delayed_work api To: Petr Mladek Cc: Christoph Hellwig , Andrew Morton , Felix Kuehling , Jens Axboe , "J. Bruce Fields" , Peter Zijlstra , Frederic Weisbecker , Marcelo Tosatti , Ilias Stamatis , Rob Clark , Mathieu Desnoyers , Liang Chen , Linux Kernel Mailing List , kernel-team Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > which is not cool because it will make the > > asynchronous effort a no-op. Is there a way we can include caller > > thread metadata(task_struct pointer?) when it enqueues the work so > > that the RT worker thread won't preempt the caller thread when that > > queued work gets scheduled? Probably require the CPU scheduler to poke > > at the next work...or any other ideas will be very appreciated, > > thanks! > > This sounds like a very strange use case. > Why is the worker kthread RT when the work can be delayed? > > If the kthread has to be RT because of another work then > your proposal will not work. The delayed processing of > low priority work might block and delay any pending > high priority work. > > You should consider handling the less important work in a separate > kthread worker with a lower priority or by the system workqueue. Just want to clarify that it's not about delayed_work any more. In my latest question, it's a RT thread with normal work queued and scheduled to be run immediately. However, I simply don't want the worker to preempt the thread that queues the work. It's a high prio work that we don't want other random tasks to preempt it. Meanwhile, we don't want it to preempt the called thread. In addition, assume we can't raise the priority of those caller threads(otherwise I'd be fine with using a workqueue).