From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB14BC43464 for ; Mon, 21 Sep 2020 08:11:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7A43A2085B for ; Mon, 21 Sep 2020 08:11:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="b0Q7H0Pt" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726461AbgIUILW (ORCPT ); Mon, 21 Sep 2020 04:11:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726355AbgIUILW (ORCPT ); Mon, 21 Sep 2020 04:11:22 -0400 Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E6CEC061755 for ; Mon, 21 Sep 2020 01:11:22 -0700 (PDT) Received: by mail-io1-xd41.google.com with SMTP id r25so14491531ioj.0 for ; Mon, 21 Sep 2020 01:11:22 -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=LlIIJsBl6C7C1WRKfagWEHAxXUQGBUS8dNq6MjzRPjI=; b=b0Q7H0PtsEDxFfRrvv56hGyowU8mZDWGLmT+aycj/Upqa5CP5Q4P3ibDX4xU/Nikps SgENbjqA++YUfKJWzv2mYwKqjmd5bjGsX8kOTQcGH3MNkpUhLnu5nn7sW1hfGnY5fiGN PZzLEIP3TMoIc2glP+dSMvfwsTQTapdTwcl/OGuWQSSjXClOMyk5SUy01A5Ljx6QJ9Tt 9UnvkwxFw7NpCBzfmSZi1qOTfclvjZ3GtS4064WEXg4ESkbQqL0H8fl78PMEirw1fb3Z bOfrvK5f+YAfm0JWjdrIe7T5uj39hdmqpPVQ/isPyMPDee4EO5yuWdMQnx86zOp6e8O7 JlKw== 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=LlIIJsBl6C7C1WRKfagWEHAxXUQGBUS8dNq6MjzRPjI=; b=n89e3F8vpt8lczvBtl1M8ZUpbySJ4vpz9JIEqZEfuupq8oX6JX0YHu9KLBP4rRUtND fTiukmmCvBmHSZBkekWcmWbkcaNekhaxX7Ud955Mt+5omo5q9Wfg3/z/SoKSG5c29bes lXdGZ45BbgItxE0XXAS+YDEJLbWZ/hanHqZ5+wItjcktZ+8iaG5YooxJ/4KLLkWfjHWY iXUXHcDe4YkyQLkan+99VXiXjI4YXQN2QJQx+xMmLb6UDvR4ixrnKqTlFKpW5CaUv8TZ KXZG5CK8cAkb4aU0GkExxhb4y9gUdvE1pJCZmof3zwjn71UJYvSZJhMUW3+l1IbPzUl9 xOKQ== X-Gm-Message-State: AOAM533sQHLKHWc+1CRhvZ7m4oz024SZPSbJk2H4zzeuAbo/+jNFcVNb Jz/Imu6fSfaPiatVUTBGoFE8vhACix7+PfxSSvhIfg== X-Google-Smtp-Source: ABdhPJwgdGMME3LCofoKrCUqayp8IlaYsq93DhlTXjrYkMb+ogfeI8cDqG01Fmo4vbaKaG36dV7Ie0gH8HoOdqnTPIQ= X-Received: by 2002:a6b:3bd3:: with SMTP id i202mr35795034ioa.145.1600675881172; Mon, 21 Sep 2020 01:11:21 -0700 (PDT) MIME-Version: 1.0 References: <20200914172453.1833883-1-weiwan@google.com> <20200914172453.1833883-6-weiwan@google.com> In-Reply-To: From: Eric Dumazet Date: Mon, 21 Sep 2020 10:11:09 +0200 Message-ID: Subject: Re: [RFC PATCH net-next 5/6] net: process RPS/RFS work in kthread context To: Wei Wang Cc: "David S . Miller" , Linux Kernel Network Developers , Jakub Kicinski , Paolo Abeni , Hannes Frederic Sowa , Felix Fietkau Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Sat, Sep 19, 2020 at 12:45 AM Wei Wang wrote: > > On Mon, Sep 14, 2020 at 10:26 AM Wei Wang wrote: > > > > From: Paolo Abeni > > > > This patch adds the missing part to handle RFS/RPS in the napi thread > > handler and makes sure RPS/RFS works properly when using kthread to do > > napi poll. > > > > Signed-off-by: Paolo Abeni > > Signed-off-by: Wei Wang > > --- > > With some more thoughts, I think this patch is not needed. RPS/RFS > uses its own napi (sd->backlog) which currently does not have > NAPI_STATE_THREADED set. So it is still being handled in softirq > context by net_rx_action(). > I will remove this patch in the next version if no one objects. The purpose of the patch was to make sure to kick the IPI I think we need it, otherwise RPS/RFS might add a lot of jitter. > > > > net/core/dev.c | 7 +++++++ > > 1 file changed, 7 insertions(+) > > > > diff --git a/net/core/dev.c b/net/core/dev.c > > index be676c21bdc4..ab8af727058b 100644 > > --- a/net/core/dev.c > > +++ b/net/core/dev.c > > @@ -6820,6 +6820,7 @@ static int napi_thread_wait(struct napi_struct *napi) > > static int napi_threaded_poll(void *data) > > { > > struct napi_struct *napi = data; > > + struct softnet_data *sd; > > void *have; > > > > while (!napi_thread_wait(napi)) { > > @@ -6835,6 +6836,12 @@ static int napi_threaded_poll(void *data) > > __kfree_skb_flush(); > > local_bh_enable(); > > > > + sd = this_cpu_ptr(&softnet_data); > > + if (sd_has_rps_ipi_waiting(sd)) { > > + local_irq_disable(); > > + net_rps_action_and_irq_enable(sd); > > + } > > + > > if (!repoll) > > break; > > > > -- > > 2.28.0.618.gf4bc123cb7-goog > >