Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp306146pxu; Fri, 23 Oct 2020 00:51:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwx502pEsu58fiRyZ5TKVZkHAkJmPvNIDwbcwYNFBvAfEr+opyWX+3OL7UoVm2Qhz9Xy2Sl X-Received: by 2002:aa7:d4c6:: with SMTP id t6mr954373edr.372.1603439501595; Fri, 23 Oct 2020 00:51:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603439501; cv=none; d=google.com; s=arc-20160816; b=Vdk+71V05P7p2ePYOY4HhdgeejtNwrln2PDev2IqWjX9GYQkZQW54pcXUNYDk+1NTc JykT2q/mfH7cdpD1pX/KwE3yCktN0dkB+iazi111GcruP+OBVy2Ozeni49xyvsaSrE+Z MAnWXjP0QPMtTAyfb5QtfIMk3f634vELOOSZOAFpfMQXuN9A2+/2OcIUo6HPUaasaUVy ppbd8gHZWG6+0xBOeQ2PdVGbQkLln1+6ZnErUOZLNfdCRS+CicrklGPbZTkOcUSXqMFn j8lKXtTiJ1darQpKpUx9gRRx08fgiVo3opG9Cv/f9Lur9nrjD/FKAfrtrVSxcS03gP05 PWgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:sender:dkim-signature; bh=6HFlEVpudWH5pffnpQkc+Yc/oxstkbax6tUIXieA0lk=; b=W3TT4MAmfqZbbiZ1pnvlI3pKYXNTq5C/U/4EP4bhmo2/vrq4s9+LOWeJmDn8/DSd88 35EdKrfxhmTPq9nbSaIX2ZBtHWXY19nGWPDf9xOJHoImUoeHFn0BSAI9ZijhAFWOQrQh VqJaP6RMec5xQEH+5kKRdPrk9UbFnmeoZlMYkqIelqugw6eideLEgFbF9+2ACgZOVBSQ sN65oeJ4dKETU52H3TjKSbADifrhjTzDZWdGAsIf/qF0KdmXIXhljJ95Z2ZKZBSqSC4F Awg5f0Py6Gwb5+KWI0qv5D7uYyAsKy5jDYqVdoC3oWEfDKYZKU6T8BN62u1b2o2dCDJC JTkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="iVgGGpv/"; 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 j19si296949edr.278.2020.10.23.00.51.19; Fri, 23 Oct 2020 00:51:41 -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="iVgGGpv/"; 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 S374857AbgJWDag (ORCPT + 99 others); Thu, 22 Oct 2020 23:30:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S374855AbgJWDa3 (ORCPT ); Thu, 22 Oct 2020 23:30:29 -0400 Received: from mail-qv1-xf4a.google.com (mail-qv1-xf4a.google.com [IPv6:2607:f8b0:4864:20::f4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9919AC0613CF for ; Thu, 22 Oct 2020 20:30:27 -0700 (PDT) Received: by mail-qv1-xf4a.google.com with SMTP id s9so114543qvd.17 for ; Thu, 22 Oct 2020 20:30:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=6HFlEVpudWH5pffnpQkc+Yc/oxstkbax6tUIXieA0lk=; b=iVgGGpv/7FVDQ3pQoJo5ENDkVCIPPnAb2W/P85Q5YObYQ2qOZxGF5aIUBugdD4WxjU Z5RiS70Guwrf2/je+hqDDOaMglLC2zunZShamfYLdW7/LeCKyl0Jm+323jMv/JP4bdLn Cnc1mlvlswebVTlRL7llKF7A6RsRxb5HywKIzg2GugnXeaGy2yJebCLgsW4mT3HNGT67 Q9Ykutn29AadOxcTFqlJfponLBNNUotM0TG5bkKPWwVkNvEfLOzYa4mI5lFBvayOC1b3 zP5wOtjf8ftz3PMQHQr6qhUXN6Jm0YYw/T2c3+BrXI0d1YjElTouA69Vo9i4xhiZB1ok Vx0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=6HFlEVpudWH5pffnpQkc+Yc/oxstkbax6tUIXieA0lk=; b=p1t/h43LwhrM+uJ9DLDuv0EFsPzbSbC84v0j1zVHxW6NKleyOYSpy5JugspJB1uT2u ictlpx6ubSYy5MhdizLX9tbLFHPCL8iIgFu51QQLFbnvqfcI/YmV247aytKOEe3yf+zm b/w+mrixKKpljSYFRtKwm3Hsu1ALaWUC0fekmiUJ4g2udrtvDEL64be27DL4U/isjVTD J7mi4fB6UL0GJJAEUonpv1oCYdrBHcfkl6EWTwUUn4aQObx9MjiMtK+oHF1e1h+oAydo p0aKLiPd34xHq8HcJlR2ZY3EQ41NYACMGH9jBnVRkBxAZJ6HOUjJ+TPNIY18ZCmvN6Hq f4yQ== X-Gm-Message-State: AOAM533P0v0p5VrgTkAKC4ZDcfxskfasROpOOGsehIezI7bAssBdG2sE bUVq9k3ekLiWneInE6nv2QfpOphZmB3V Sender: "joshdon via sendgmr" X-Received: from joshdon.svl.corp.google.com ([2620:15c:2cd:202:a28c:fdff:fee1:cc86]) (user=joshdon job=sendgmr) by 2002:ad4:43ca:: with SMTP id o10mr376677qvs.33.1603423826790; Thu, 22 Oct 2020 20:30:26 -0700 (PDT) Date: Thu, 22 Oct 2020 20:29:44 -0700 In-Reply-To: <20201023032944.399861-1-joshdon@google.com> Message-Id: <20201023032944.399861-3-joshdon@google.com> Mime-Version: 1.0 References: <20201023032944.399861-1-joshdon@google.com> X-Mailer: git-send-email 2.29.0.rc1.297.gfa9743e501-goog Subject: [PATCH 3/3] net: better handling for network busy poll From: Josh Don To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , "David S. Miller" , Jakub Kicinski Cc: 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, Josh Don , Xi Wang Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the new functions prepare_to_busy_poll() and friends to napi_busy_loop(). The busy polling cpu will be considered an idle target during wake up balancing. Suggested-by: Xi Wang Signed-off-by: Josh Don Signed-off-by: Xi Wang --- net/core/dev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/core/dev.c b/net/core/dev.c index 266073e300b5..4fb4ae4b27fc 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -6476,7 +6476,7 @@ void napi_busy_loop(unsigned int napi_id, if (!napi) goto out; - preempt_disable(); + prepare_to_busy_poll(); /* disables preemption */ for (;;) { int work = 0; @@ -6509,10 +6509,10 @@ void napi_busy_loop(unsigned int napi_id, if (!loop_end || loop_end(loop_end_arg, start_time)) break; - if (unlikely(need_resched())) { + if (unlikely(!continue_busy_poll())) { if (napi_poll) busy_poll_stop(napi, have_poll_lock); - preempt_enable(); + end_busy_poll(true); rcu_read_unlock(); cond_resched(); if (loop_end(loop_end_arg, start_time)) @@ -6523,7 +6523,7 @@ void napi_busy_loop(unsigned int napi_id, } if (napi_poll) busy_poll_stop(napi, have_poll_lock); - preempt_enable(); + end_busy_poll(true); out: rcu_read_unlock(); } -- 2.29.0.rc1.297.gfa9743e501-goog