Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3866034imu; Mon, 28 Jan 2019 12:16:26 -0800 (PST) X-Google-Smtp-Source: ALg8bN5B2bYW5F7c1iIidGr4M1pThw9OBlshLvDRr8TWbJgUVwixHHuaLXwD7GCya2QLia34g6dA X-Received: by 2002:a17:902:f44:: with SMTP id 62mr23352795ply.38.1548706586537; Mon, 28 Jan 2019 12:16:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548706586; cv=none; d=google.com; s=arc-20160816; b=TB2qINA4Si+yujVnhEHVrpCC2lz/YbTVnHseS6U1p9kF4ZnKmz8AOIMb6XY38GYRl2 8NXdC83tP5EsdKCeqYUZKhiB0wwhmDv5K5JYhFnn9BhttNRk0vHW78WmNAfGq8xia6xt uDq9odvHIl2O+yK4ACaX96TXOjj18qqnqM2+u47us+nsuTC6gTBXGV6tCPvnbqG3FSrA ajPZ0zJmBCmH2gxhp7I+7/JpIJ6GbByR7b0069cNO/r6UHAxpGwXCOabIJgM/TA50hAN fqt21q2KiCw3vQr70/KHsQfyQurtMCh1UiV9K6UHcmzogneJtvGIkH2bcFLljwK/e6Ll ebtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=i/diQOGkXR8GMA0o3Y5WRWapwL2ejQb39B0HrHbulmo=; b=elHdaAR4qlDiKHVFCy+XO05Y8CReeIlZZ/njWliwmsv1ZetINOOzJWqIO5alQ9wTOz a/56OVBlv/SFpcKXOjUoKslnh/qiHBpqrDv7ig3OrvrMvdawOFAUY/otYZK/lOgYHN9B u6ARKU5XgzFj+fUxGROn+l2j8W4ZdEnps4xWBuJFcACBkjxU7f56CcnJDLKNCfkh397d COToT2eqdi8DmZrN9FXrs3JL44hUlF/pFwCsVX99VcAvxmi1GS3Ykdg0g21vPyzIUEm+ YpMq5ExT3qPigYFuRsFug/xXyIYfpJ2ejDXqoZqCQ6T7Xo5fVS108FixVumvfT7yWeaD dfEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Zwcw3zfk; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h6si3928480plk.231.2019.01.28.12.16.10; Mon, 28 Jan 2019 12:16:26 -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=@linux-foundation.org header.s=google header.b=Zwcw3zfk; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726993AbfA1UOT (ORCPT + 99 others); Mon, 28 Jan 2019 15:14:19 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:46817 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726719AbfA1UOT (ORCPT ); Mon, 28 Jan 2019 15:14:19 -0500 Received: by mail-lj1-f193.google.com with SMTP id v15-v6so15383991ljh.13 for ; Mon, 28 Jan 2019 12:14:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=i/diQOGkXR8GMA0o3Y5WRWapwL2ejQb39B0HrHbulmo=; b=Zwcw3zfkxXXHlAMJBtSSPW7o9+sdXTpbHPFcTndePKBBt8G144PQA9b2V/pa0HTGFs Q4s3SjTdEZFd46XyJttSZZO4LFDE2+xRcUgOXs3b3R+DDS4HAamVgGtYic0oc0SwiBms FwtSE5YyOKkQn3Ffi9GGVtP7RQajqUIhxvTvI= 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=i/diQOGkXR8GMA0o3Y5WRWapwL2ejQb39B0HrHbulmo=; b=NqbArfLU1qfftL7o0PB816SIUn7bjkIFKel1Q23uGH4/9lYE5KBRVtldbVXsuGdJRe UruHQNuKHmkdVc/NhU5wYEBdBgong9P57V4ndtcFClWTr1MG+WaNAmWQKlyHQoq/MRGp W4LDZ1UBysAi2qz2akiXegaPkowhyZa0Rb6Iey/q/yNZnEHET2SDqlOBg03G5SdCi0vw C60dMhtU6IAJIyQh0mDhwwrBA/4CqFBrulDMWXzoha/dxuksS5H0gzNHlbn6UUEIo59w ia9sRmeURIE3nkNLO7qXb5McON1YBwj88rOExzOTh2zTDNU33O+FkSPnatlcASngR/CB a9RA== X-Gm-Message-State: AJcUukfAhfFGn6SRthL2L98Fh7FVE33YTP+T61TeUiUz6PPTEmZAAJFU uDeRGrNPoCs7MS7nKhTG6UFtjgfT+r8= X-Received: by 2002:a2e:568d:: with SMTP id k13-v6mr19688000lje.105.1548706456561; Mon, 28 Jan 2019 12:14:16 -0800 (PST) Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com. [209.85.167.44]) by smtp.gmail.com with ESMTPSA id c133sm3453680lfc.45.2019.01.28.12.14.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Jan 2019 12:14:15 -0800 (PST) Received: by mail-lf1-f44.google.com with SMTP id f5so12826119lfc.13 for ; Mon, 28 Jan 2019 12:14:15 -0800 (PST) X-Received: by 2002:a19:1a14:: with SMTP id a20mr17296800lfa.1.1548706455149; Mon, 28 Jan 2019 12:14:15 -0800 (PST) MIME-Version: 1.0 References: <20190110101232.9398-1-o.rempel@pengutronix.de> <20190110101232.9398-4-o.rempel@pengutronix.de> <20190110151953.qpat4t7lat6plfk6@pengutronix.de> <20190110163030.GB19693@kroah.com> <7a593f3b-0019-c30f-30e8-34eae7b96cf0@pengutronix.de> <20190128082313.GA15182@kroah.com> In-Reply-To: From: Linus Torvalds Date: Mon, 28 Jan 2019 12:13:59 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v1 3/3] drivers/tty: increase priority for tty_buffer_worker To: Oleksij Rempel Cc: Greg Kroah-Hartman , Jiri Slaby , Pengutronix Kernel Team , lkml Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 28, 2019 at 12:03 PM Linus Torvalds wrote: > > That's harder to do for reads - because incoming characters happen in > interrupt context, but shouldn't be all that hard to do for writes. Side note: the reason I mention this part is that "harder" may not mean "impossible". In particular, I wonder if we could do the tty buffer flipping in the reader context too. Currently, what happens is that when we receive characters, we schedule things for flipping with the workqueues. *BUT* we could also just wake up any pending readers directly, and maybe have the *readers* do the flip if they wake up before the workqueue. And that would allow you to do real-time serial work simply by marking the process *you* care about as RT, and not worry so much about the workqueue threads at all. The workqueue threads would be fallbacks for when there isn't an active reader at all. I dunno. A bit handwavy, I know, but it sounds like if you care about the read latency, that would be a better model entirely (skipping the technically unnecessary kernel workqueue entirely). Linus