Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp740638pxu; Fri, 23 Oct 2020 12:04:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/8UzG+nOEe3BNt0FIhefRBmBHDR2piACf11h+uX4sBxVpWwDL07iVX/7scd6JCsQw/GKi X-Received: by 2002:a17:906:1e08:: with SMTP id g8mr3431905ejj.358.1603479878995; Fri, 23 Oct 2020 12:04:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603479878; cv=none; d=google.com; s=arc-20160816; b=P/8YV9crarEWWL8moKKYCIekuGtVaqDVswZwXI9gFxK3M672ulD/Zx3/ks2yWA54h4 Gv3HDdRi7Xfc7z3c2KAwlo94O5x2Aqo00naOYH639TM9wv/hi6vDhssPLRlPeAd0+/ic 84z6NFEeUH7gS5MbkEXf0UtjILoE9QL2byUaICoGKzp+cLQMQWGtwR5e/qnHxyjD2cOf hfRa+EJDAWo9Fg22pEWaRwT74hXy1SXIkysaxZ3DkjmDGOVcg46IjAGxK0qzZWm6H5I1 Yt1VCutb2oM9zAlspB0fDZoqS7v3OKvq+AyEYIRhwCxvjFIjzkqxSPi4Co12ESY4MGPe Eclg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=PxM1TwatTPJtFARtkSFcTBb3+YfaCdQEgcwkBa3mSzk=; b=m+uS9lx4BHfwNssLrheWRd6dwYIJlwtayVYOS+JVwkxTxbYWFU4QDkt6gyiYFRTrl4 +02HdcwkHNcb2O2XAENIrpjeKad30Lbj5FFQpnVjwnToTfvjL4bp7lPPoj3XdKU8FC70 Cd3OiwtsNyW/fg5bkEPStz3fYNHvow/aOL9sDjv9LD2R5mqBeMmGgVpJzFsX5T7ypJRC 8fA+2LpOXRiTXeUKXvtBFOIIjcjolLeYA3Kf5o/kp3IG94bkgafMxYWUwPE5QHi3BJp6 zxJNXbrEhUnucg2t4a5no6rtpvYYL1QHkYGxlseiTINB8Jad9uEydjx8bWeTpZLhfHyr ILLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=k9fHBrAY; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f8si938273eds.551.2020.10.23.12.04.16; Fri, 23 Oct 2020 12:04: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; dkim=pass header.i=@kernel.org header.s=default header.b=k9fHBrAY; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753814AbgJWRs4 (ORCPT + 99 others); Fri, 23 Oct 2020 13:48:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:39740 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S462375AbgJWRs4 (ORCPT ); Fri, 23 Oct 2020 13:48:56 -0400 Received: from kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net (unknown [163.114.132.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2E2A021582; Fri, 23 Oct 2020 17:48:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603475335; bh=yB/s/IuPvxvA/D6puPVcHV6lCpGyQvaLhZjmJ20tayI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=k9fHBrAYM+wp3NSCtKkRtPQhXi4dbODGDL1e5+yrI0yvizi07AfTLwsncPus7fsq3 PgzedNtYAq/z8dABaFdKA5m0OuRfVF24Yw3iSKjqeu+QWxiEWHLtB6J+olk3nzZOzR okJSUOlRqfDaLjGwcw8+aGODIQel3BFuv/X1NEiQ= Date: Fri, 23 Oct 2020 10:48:53 -0700 From: Jakub Kicinski To: Josh Don 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@vger.kernel.org, netdev@vger.kernel.org, kvm@vger.kernel.org, Xi Wang Subject: Re: [PATCH 1/3] sched: better handling for busy polling loops Message-ID: <20201023104853.55ef1c20@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net> In-Reply-To: <20201023032944.399861-1-joshdon@google.com> References: <20201023032944.399861-1-joshdon@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > 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?