Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp642969pxk; Thu, 1 Oct 2020 10:20:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxF0/SBfp9Ie6CBvqqyNsvUsNXqQugDIIsAE5fpX3DDtEHJ3mbwSUIW8dvaGbBv1X3BY2Iq X-Received: by 2002:a17:906:b24e:: with SMTP id ce14mr9063152ejb.494.1601572828442; Thu, 01 Oct 2020 10:20:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601572828; cv=none; d=google.com; s=arc-20160816; b=Zkta3ElIbAzOlKSkTF8StyWFoFslk/1yyYS7aE2wVV51AZWSQct37AMUqOGkASa19s t1ZdobVWpi8xMgQ+6qJBAHNNitbTINIZ46nLvX3zqmrfNWeTLiK1VVbPRoEuqeQPRmJh /5fy0YE+xU96GTaNN7L0NoLNhJKZKDNjF3O4pHAaOGN+T6jhZOTJxlznYlkFCg2JGy8m CmjqmAvR9xQhqdlwsObRvDraA/XMfJxwL48dis+63tKSAAaSxB7Cq6lIe0wSulDwt2eX nTa9kDUCFSCrelF6Rq0VGQN6moF7Y5G1awv/GA2HlzoQmZZfTpDr5nYYSpYXVUbB2Q1e 8Zxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=26TNgPJnQ28vGxnL6uAXIiw6BivGl+AQcqdGkLAETno=; b=TQvAE2+LBO9VKtmX8Fd+vP9k0zgpjJQPLFlyCo+H5SZiAnD80RfKbO3HVwr/SBEXEl J6XpGaZTaFGepCWKJKT5vS90zB7DzIJGQxIoSbNbFBByTHUzAoT5YQB4QUYenOy0K7nM lY7DpZHy1IM+Hi7m2reABza8oeFbGC4JZJlwDfQgWkkWgVk+AQo08kye8wHgR1K3C8lU 3LB7QASU43UqoP0u/AILjTYQOW+AGdfguZmrcbiUJ9RIwljo6TkZ5sijE5WAIUuDsBn0 zUHJasOZ9QWaX3WV7gNl+dw7wQJczK9oHazAUQR//ymwMOBTZ74DABgeYi5PyU0Gfrdi cztw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b="Vn/KaplL"; 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 s16si3775954edq.536.2020.10.01.10.20.04; Thu, 01 Oct 2020 10:20:28 -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; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b="Vn/KaplL"; 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 S1732704AbgJARRs (ORCPT + 99 others); Thu, 1 Oct 2020 13:17:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732274AbgJARRs (ORCPT ); Thu, 1 Oct 2020 13:17:48 -0400 Received: from mail-il1-x144.google.com (mail-il1-x144.google.com [IPv6:2607:f8b0:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23C27C0613E2 for ; Thu, 1 Oct 2020 10:17:47 -0700 (PDT) Received: by mail-il1-x144.google.com with SMTP id l16so6896496ilt.13 for ; Thu, 01 Oct 2020 10:17:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=26TNgPJnQ28vGxnL6uAXIiw6BivGl+AQcqdGkLAETno=; b=Vn/KaplLHlB4hObRWV9LvekIYidf0QcYnVlNVg165AcT/4WoGDV47plesoLDvcxZju 02rPULrU2OoBO7/CrgujuBox0GYnRkjuqIxRA9keN0gckfGnFYwXsQhCbrdr1D99ukwU sdC0uQJnfKK9lnlPuHb9HvYUcoyltaYEUDJa76TAal4RyGmmfbNhabg7mSlh3CqtEfGq n8+j32SS6J3qi2yHxHISZPjnbZfmka7IZVDz7NYzcZAyLsP+jLptwDuNVk5fx6qsQfTr 8KqzGBIln2TNqtViWTVzhubd7TGHRyrRq5Gzy8870cSXzuJlFCkvI0iy7IeqR5J7G2Sn QYTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=26TNgPJnQ28vGxnL6uAXIiw6BivGl+AQcqdGkLAETno=; b=FbGWiynqgAaLY/MUD0YiKUbq6Xzz3ermq4AJxp7dFfqLYX+HYqpPwpEIZW4coFd86P p1eXJeDz6OTcXhd0aoJA3zOuhvMJPNbWuDJMsN3zQZkV+vuLa3OQ4q3zPfdck80kYGz1 ML1LpCiY+57Nrk7PxfIUfb8KNSqae+/dfmY5gkoIfuIW1Sr4gG9BPKkhKlThTmQeL0Z/ 93dlyoQY9iyF9u5OPFEybrRtiDw9qWmV5jWOXvcokq2hsrSjPAbMUJbT04O9JWhUoSQJ LAMfrKoRXlqGY/QI61B0YKF4WhI00lad3Iz31ZHsNHd2on31ylm0qHR4LnEY6b6GlCzm ocow== X-Gm-Message-State: AOAM530rDSpkuylwxpCZ4tgQogCJX+tdyBtISLWB7yINik3JUQBmeHh/ LmG5yxkoh/rOyhvIvMvvQMdvFQ== X-Received: by 2002:a05:6e02:1411:: with SMTP id n17mr3303844ilo.211.1601572666281; Thu, 01 Oct 2020 10:17:46 -0700 (PDT) Received: from [192.168.1.30] ([65.144.74.34]) by smtp.gmail.com with ESMTPSA id d8sm3229266ilu.2.2020.10.01.10.17.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 01 Oct 2020 10:17:45 -0700 (PDT) Subject: Re: [PATCH RFC] kernel: decouple TASK_WORK TWA_SIGNAL handling from signals To: Thomas Gleixner , io-uring , "linux-kernel@vger.kernel.org" Cc: Peter Zijlstra , Oleg Nesterov References: <0b5336a7-c975-a8f8-e988-e983e2340d99@kernel.dk> <875z7uezys.fsf@nanos.tec.linutronix.de> <3eafe8ec-7d31-bd46-8641-2d26aca5420d@kernel.dk> <87362yeyku.fsf@nanos.tec.linutronix.de> From: Jens Axboe Message-ID: <8a98b921-c1c6-c1b7-e0ff-e2179badda55@kernel.dk> Date: Thu, 1 Oct 2020 11:17:44 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <87362yeyku.fsf@nanos.tec.linutronix.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/1/20 9:49 AM, Thomas Gleixner wrote: >>> This is really a hack. TWA_SIGNAL is a misnomer with the new >>> functionality and combined with the above >>> >>> if (!ret && !notify) >>> wake_up_process(tsk); >>> >>> there is not really a big difference between TWA_RESUME and TWA_SIGNAL >>> anymore. Just the delivery mode and the syscall restart magic. >> >> Agree, maybe it'd make more sense to rename TWA_SIGNAL to TWA_RESTART or >> something like that. The only user of this is io_uring, so it's not like >> it's a lot of churn to do so. > > I really hate that extra TIF flag just for this. We have way too many > already and there is work in progress already to address that. I told > other people already that new TIF flags are not going to happen unless > the mess is cleaned up. There is work in progress to do so. I'm open to alternatives, but it does seem like the best match for something like this... >>> This needs a lot more thoughts. >> >> Definitely, which is why I'm posting it as an RFC. It fixes a real >> performance regression, and there's no reliable way to use TWA_RESUME >> that I can tell. > > It's not a performance regression simply because the stuff you had in > the first place which had more performance was broken. We are not > measuring broken vs. correct, really. > > You are looking for a way to make stuff perform better and that's > something totally different and does not need to be rushed. Especially > rushing stuff into sensible areas like the entry code is not going to > happen just because you screwed up your initial design. Nobody is rushing anything - I noticed that I messed up the syscall restart for task_work && signal, so I fixed it. I'm quite happy taking my time getting this done the right way. >> What kind of restart behavior do we need? Before this change, everytime >> _TIF_SIGPENDING is set and we don't deliver a signal in the loop, we go >> through the syscall restart code. After this change, we only do so at >> the end. I'm assuming that's your objection? > > No. That should work by some definition of work, but doing a restart > while delivering a signal cannot work at all. Right, this is what v2 fixes, and why I sent it out. >> For _TIF_TASKWORK, we'll always want to restat the system call, if we >> were currently doing one. For signals, only if we didn't deliver a >> signal. So we'll want to retain the restart inside signal delivery? > > No. This needs more thoughts about how restart handling is supposed to > work in the bigger picture and I'm not going to look at new versions of > this which are rushed out every half an hour unless there is a proper > analysis of how all this should play together in a way which does not > make an utter mess of everything. Again, this is an RFC, I'm soliciting comments on how we can make this work. I'd appreciate any hints and help in that regard of course. Thanks, -- Jens Axboe