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=-4.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 4B897C43460 for ; Fri, 9 Apr 2021 11:50:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 29F276115B for ; Fri, 9 Apr 2021 11:50:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233437AbhDILuh (ORCPT ); Fri, 9 Apr 2021 07:50:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231599AbhDILuc (ORCPT ); Fri, 9 Apr 2021 07:50:32 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 449A6C061760; Fri, 9 Apr 2021 04:50:19 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id 5-20020a05600c0245b029011a8273f85eso2836137wmj.1; Fri, 09 Apr 2021 04:50:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=5w0D0I/DpWkHUYPOs9kZ8KUrL2jeXir0cySNED2VroM=; b=XPqMUz+/46oxHBegWofgVdr8ELuknw2rI5cr/mfm7gRY6xIbONeqBUkXJk5JnkyOSa J+jNJJHwfXs2guDfz8d+xDNYKvl+9+i6yEcmciVAuguHGmEZWagFOG/HUpXcjCgNadZE WO+YWdEugYBE7EoWJHRhDOfQjCAjSBt9hNkmuKIaDyz4B6Z5axBeyTDz0lDbw6f7JRDr +107rPHBBMeMd4z19aqSdzh3+uj6e+7YkGrk02I8UCcHKMzVmM0E6Fv+rJonimnDSMNX KmVjk2A0VinUIaQey/70TGrVlB/HJV1DqN8dI/lpdIHSQ5VNLFrXmZ26ikIWgoCOU7WV Ve3Q== 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=5w0D0I/DpWkHUYPOs9kZ8KUrL2jeXir0cySNED2VroM=; b=WVKE5NDJX+jslJVO/tGBEJHiDcWdvd3alFF7/tmmFuS2qb0olgirkc1d/+V4FQXv/i z/CCq7W5tffFqPnxNeIxsQ+ATQRSXwZl6i69mAsK3bFG5qKf4xCm+dq8xpA1XZHwRt70 ITZuwxZm3iWoJhbM2flopSlPnk8Gn3/JGDiXxRs5a/44H6pSR2L+YHpcC7w+ZwU5tP9V YpUAeQix7OzglpHZbdyOsH53ShaYCFsTizxw6e6u98ww4uQa6xI1d0wivmIh07hSs9Dt BQv5vaoaxGjYvpd0AFtfbf0LY9o6onfN6yKzXB0/eIuJCWyitcO1Wc2tqee5eN0gwo59 65sw== X-Gm-Message-State: AOAM531iuqeI4NOzWtHtWWaY0JWE6fQEB0s5El+UecQezTroGrN+tpI0 3BDmKnSPkBX+hPdYH1duqwY5FB4fknQ= X-Google-Smtp-Source: ABdhPJwLjkxggFpv/JHMMAipaeGauG7PsIZ2fhcyWoKRbqh2+kuDpadpBVpHafkGWziJELriuPSaHQ== X-Received: by 2002:a05:600c:1992:: with SMTP id t18mr13129540wmq.125.1617969017824; Fri, 09 Apr 2021 04:50:17 -0700 (PDT) Received: from [192.168.1.101] ([37.167.116.29]) by smtp.gmail.com with ESMTPSA id m26sm3544155wmg.17.2021.04.09.04.50.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Apr 2021 04:50:17 -0700 (PDT) Subject: Re: Problem in pfmemalloc skb handling in net/core/dev.c To: Xie He , Eric Dumazet Cc: Mel Gorman , Mel Gorman , jslaby@suse.cz, Neil Brown , Peter Zijlstra , Mike Christie , Eric B Munson , Sebastian Andrzej Siewior , Christoph Lameter , Andrew Morton , "David S. Miller" , Jakub Kicinski , Linux Kernel Network Developers , LKML References: <20210409073046.GI3697@techsingularity.net> <20210409084436.GK3697@techsingularity.net> <87ab3d13-f95d-07c5-fc6a-fb33e32685e5@gmail.com> From: Eric Dumazet Message-ID: <3c79924f-3603-b259-935a-2e913dc3afcd@gmail.com> Date: Fri, 9 Apr 2021 13:50:15 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: 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 4/9/21 12:14 PM, Xie He wrote: > On Fri, Apr 9, 2021 at 3:04 AM Eric Dumazet wrote: >> >> Note that pfmemalloc skbs are normally dropped in sk_filter_trim_cap() >> >> Simply make sure your protocol use it. > > It seems "sk_filter_trim_cap" needs an "struct sock" argument. Some of > my protocols act like a middle layer to another protocol and don't > have any "struct sock". Then simply copy the needed logic. > > Also, I think this is a problem in net/core/dev.c, there are a lot of > old protocols that are not aware of pfmemalloc skbs. I don't think > it's a good idea to fix them one by one. > I think you are mistaken. There is no problem in net/core/dev.c really, it uses skb_pfmemalloc_protocol() pfmemalloc is best effort really. If a layer store packets in many long living queues, it has to drop pfmemalloc packets, unless these packets are used for swapping.