Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp734365pxx; Wed, 28 Oct 2020 15:59:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYZHMahLyuExWMW+dvfYOxRsfFz6BkWkKCy63wwxv+seskIAiVy0FDI3vB5RaGHS3mvwD9 X-Received: by 2002:aa7:c6c5:: with SMTP id b5mr1246771eds.259.1603925960828; Wed, 28 Oct 2020 15:59:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603925960; cv=none; d=google.com; s=arc-20160816; b=LrG3rYo40K648IY75gQAWNDmcZiKvY8bxDfFs8EFPpYZ1ynOVG8ssEALt0lKBYxFcN vV6EHAEVu8+HINaHPQk9dO+q6BavE+Xzh+sCCC8yLdvxg71/VQ/Bn5ofMBYxG2wWq4/a 4E8u3uYecZccOWcC0fLCovH++4nlV18AVhiJos7MABBb1FzurPa+5tXRPdWAIH3PHURy Ln+rpDE9D5fj7a98+/5D4VUoiyoY6Pd2y4GF4h4Jj45JNzbuhZonV8NM3xOvwZqrxLvq iCzS8j4y9mHVMrP8qpM7kibGiaXLy9WMS9Yy2lGD9DVF7XQlZ8jj8HvZRXyRqiXqYjj/ lJxA== 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=18t2/9BUdXVT3FrRrj2981btsIjhV7OAUvBATF+KIB0=; b=FWKySTjGezjcFUX3WRKngPT/rZQAb5SuSeHVRzIH0NO3YYnibkgrF6onwrW5+PwNp6 E5lAWSE923OzSfq+fGX6YRSLH8riQmq6RqzDSxtTdEBbKoOFxLRtR9uYFCrzOeDaClFm C1IZbUrz9LUhwzcfobjdbPB5DKmvPx9NUVBUV5xLQAfCSgLU+IMl/EJBeCOKI7RyT7P3 aM2XrAyOtydihmBLBcxrdZsyjJECRq2WI2KlPn2D3/NSDx1Ams+J0oxjrTbR226AHQz9 AYihTgmpUNVHR112LPGaSnrBdtqOvohCBpVDM4Cq0bD9q4vtp3F1a9FlbWyhMrxwakn7 qMxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=k3loYIPi; 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=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d2si697053edn.245.2020.10.28.15.58.59; Wed, 28 Oct 2020 15:59:20 -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=@google.com header.s=20161025 header.b=k3loYIPi; 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=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389774AbgJ1Wzw (ORCPT + 99 others); Wed, 28 Oct 2020 18:55:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389789AbgJ1Wz0 (ORCPT ); Wed, 28 Oct 2020 18:55:26 -0400 Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3468FC0613CF for ; Wed, 28 Oct 2020 15:55:26 -0700 (PDT) Received: by mail-io1-xd42.google.com with SMTP id z17so1260776iog.11 for ; Wed, 28 Oct 2020 15:55:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=18t2/9BUdXVT3FrRrj2981btsIjhV7OAUvBATF+KIB0=; b=k3loYIPiIcMAoy/iHvUGwPZSy6eOYNJ5ySXU0mvomWoI8EVBixJPtTbiWWBENmojE5 HVounQUUhJcyiFj7vRWtbUM0vAIfmxfoxhTzD2jeeXblPYr/B+osGTlY4zvfmrD6Dnc2 n83Xx/LHBU1ayGXESahM9ZnAAw9Fdj53NGBECTVEmklZqM9Xb2xEs5zD75v/PypwlJB/ zQGS3lerJaQ67/a9WmO4MKWNdjWOhBJPu0D2q/jYeP9OkxLfi668ZRRKRh4YoJEL5yoo eB1ImiKGtkzeQrcRULLBMrp8KvKMjDePmGhAVk4lQ03OclTMTS+1OgAhqygAOUp4e6dD wnfg== 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=18t2/9BUdXVT3FrRrj2981btsIjhV7OAUvBATF+KIB0=; b=VISQY6fGw1qsWrqJ4jpVcvgyDkF0qR3Iw3Oxc1usxm94/5BYAsschzx8CSbmEE2glA HZz+gz6FWkV9XyT9Cpw1KVrr8/r+QFzttJZEymi4w8VcVW4yRHYBBiqeMkvA3hNNbZ24 8SNDlLUijyaikn/G5Y2sdB27jN6cz2Fp1haF+OMgX3TyWVyYljs38sjvG911UVx4GNSL ZDziyIyEPvP57oB0VHaTlvxbFHx+pfXYEdy7BwIySgL+lktp469HA5f91SAk9qaYXeO8 pVnMhOzXaw1mHu4TLJwNrjqN+TW7M0xKA6UEFLwTSh/iaysQa7gPLC33sAkonqHcKemE ZGWQ== X-Gm-Message-State: AOAM531FY2pjF7wYWn7Iam2DQwRBhC6DxZGDbLXxB/3Yj2SRf2yKEnlc KgSk5tubpgjfG9nGrtHO5K/0EdWHZiYn5rwReyOqOvdj1hh7rQ== X-Received: by 2002:aed:2f67:: with SMTP id l94mr4880669qtd.101.1603844962246; Tue, 27 Oct 2020 17:29:22 -0700 (PDT) MIME-Version: 1.0 References: <20201023032944.399861-1-joshdon@google.com> <20201023104853.55ef1c20@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net> In-Reply-To: <20201023104853.55ef1c20@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net> From: Josh Don Date: Tue, 27 Oct 2020 17:29:11 -0700 Message-ID: Subject: Re: [PATCH 1/3] sched: better handling for busy polling loops To: Jakub Kicinski Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , "David S. Miller" , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Paolo Bonzini , Eric Dumazet , linux-kernel , netdev@vger.kernel.org, kvm@vger.kernel.org, Xi Wang Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 23, 2020 at 10:49 AM Jakub Kicinski wrote: > > On Thu, 22 Oct 2020 20:29:42 -0700 Josh Don wrote: > > Busy polling loops in the kernel such as network socket poll and kvm > > halt polling have performance problems related to process scheduler load > > accounting. > > > > Both of the busy polling examples are opportunistic - they relinquish > > the cpu if another thread is ready to run. > > That makes it sound like the busy poll code is trying to behave like an > idle task. I thought need_resched() meant we leave when we run out of > slice, or kernel needs to go through a resched for internal reasons. No? > The issue is about the kernel's ability to identify the polling cpu, such that it _could_ send a task to that cpu and trigger a resched. > > This design, however, doesn't > > extend to multiprocessor load balancing very well. The scheduler still > > sees the busy polling cpu as 100% busy and will be less likely to put > > another thread on that cpu. In other words, if all cores are 100% > > utilized and some of them are running real workloads and some others are > > running busy polling loops, newly woken up threads will not prefer the > > busy polling cpus. System wide throughput and latency may suffer. > > IDK how well this extends to networking. Busy polling in networking is > a conscious trade-off of CPU for latency, if application chooses to > busy poll (which isn't the default) we should respect that. > > Is your use case primarily kvm? Good point, we do make use of the networking portion but this might be less applicable to users in general for that reason. KVM is the primary use case.