Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1591126pxf; Fri, 9 Apr 2021 12:15:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpRmxLN/e1P7S6qHKFn/paWy56PGo21hwccEkBFK9kVznpO/mRx5IhEqQ9LDj2CqaMMRWH X-Received: by 2002:a17:90a:5907:: with SMTP id k7mr9597532pji.197.1617995702670; Fri, 09 Apr 2021 12:15:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617995702; cv=none; d=google.com; s=arc-20160816; b=dzr+QvEkKDUQvL+QKxz4Lm9W22IGRDCZu0XmzWCcM6fyk8WOSbZ+7r2qhP5ZdUF1NC +Q8So6itXo/gEjaxbp3+AE7yl9iLAetVaQThNxFcvPZJHNvAqIhxZQRhLUWMzYw6jdXZ AkpmYHH0AZ0fvqOg8yonRmkonfPDFIggaeVnFZLx0o/a3Qkk3fdfJ/lDotncCEXDkWTL TGZjE3dWSGHaIf8bz3jBS6F3hVA1izPtjOfxJSY7eAeow5SGuQ0bJUofASDdCERImDCv l7fFF8O705Hlhqi+J3ORSTUa8ynPOFeQun63cDfMXLHw/hf5svIjpHoExocFexbGwyV6 eGjQ== 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=D0A/Cc8hdMaD+El6MEJZ9FzF6kVCbUYdGbS7BSYWv4w=; b=Oew1g0MapPEIUNsr6THgwq8xLwVvJ5wgZrnOD3viDE3mjkehgb4BMcVzZFpgUIpeZW YcASdSBL67xcfJf3vkRxpzrYGBoS/OQBAtrKnIW++cVKpeYbLex4rlcSlXeK2HV7xH7p uU7FHwppVlFLrblazfN3Zy/EMN+Uo0YdvRBWfSRCp0VVKsz60b/F09b5Mg6r02ZCpUBv G+c3ielFr6DxrRNcsDWaV6HjOxQlrTZwe5J+bIbBY5bknwD0ZHeTFbc73Zxo5Tos3QTD TtV5KRpvl9uC+W6/F1/SNIux2prLgFaCikP0ibve2+KKtmmyXunfqqB0W6qR3A7JslIn RTeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Zom8TnsC; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m7si4114769pgn.256.2021.04.09.12.14.50; Fri, 09 Apr 2021 12:15:02 -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=@gmail.com header.s=20161025 header.b=Zom8TnsC; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234957AbhDITNW (ORCPT + 99 others); Fri, 9 Apr 2021 15:13:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234692AbhDITNV (ORCPT ); Fri, 9 Apr 2021 15:13:21 -0400 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51BC0C061762; Fri, 9 Apr 2021 12:13:08 -0700 (PDT) Received: by mail-pf1-x430.google.com with SMTP id q5so4847760pfh.10; Fri, 09 Apr 2021 12:13:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=D0A/Cc8hdMaD+El6MEJZ9FzF6kVCbUYdGbS7BSYWv4w=; b=Zom8TnsCmt9waqDyDmehlMdo3U/FtzgiQHC1r1S7grbrvnJuz8G5m2PNhFdOm1QPc7 dJ8h4uGx3FD+mYPEGLbRcZgUUBH+FtQEwXG7PjHXrDFU4IovGHCj1YNEqmbA2QS9xcpv cg7S5oF59hLwyXRR84MfO9THrcHMIjm6db/EK6wdM4fcMwcl6nkVVwHsvfKFGpCp0v50 az4YNuig+5iK0DhFCHu9Ll83O8wKwOmQIUKYVQs2+/Bb+1GgjgxkjTXKUL9trdwceAI8 Y+7ZA6/8SuZYmolCpOCCZAA5GE6cqFLul0rwYrS3iprAuk794crgpHY3vFL2Tb75A2XR JZRg== 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=D0A/Cc8hdMaD+El6MEJZ9FzF6kVCbUYdGbS7BSYWv4w=; b=QJKq5EF8GpQH27va8/COkFctP2K/H6ScNge+MpqrovF5eNFdcjSxcyXBbHl+0OR4xf Fuo7lT5s0Q+RpbWOpwtMYFDbjroJt2x8HqS5tVRVd0MlHRzM7UM+Lg20BWeTPeBfT1wJ nBb0C/qgbimIHoOVzYyfcr30654dT/XoTMeWEs+rBpQkgHynql8ChJKlpAC5oyt53esQ OHo8TODbKvrKmO0iJRka0gKyLYf8RYMh5vx6bSLArnZ+i+JmdqXhYfIjdnuXgEzVh2hC YKL65iyaHggNGarnWC2T/FEzunkZD6eI3EoxujVeH3IXrrrkI8Z1J7LoWAz8f5sziwJ4 OUOg== X-Gm-Message-State: AOAM531GMYQRD3+KXwkmtsxWXLQQ5Nb5gH3YAKxOXmfr5Rbp3AfVNEBl coGvbs8rzNwSSuJmqZTURn3eJnXJtITehOsNKvE= X-Received: by 2002:a63:fd44:: with SMTP id m4mr14939217pgj.233.1617995587894; Fri, 09 Apr 2021 12:13:07 -0700 (PDT) MIME-Version: 1.0 References: <20210409073046.GI3697@techsingularity.net> <20210409084436.GK3697@techsingularity.net> <87ab3d13-f95d-07c5-fc6a-fb33e32685e5@gmail.com> <3c79924f-3603-b259-935a-2e913dc3afcd@gmail.com> In-Reply-To: <3c79924f-3603-b259-935a-2e913dc3afcd@gmail.com> From: Xie He Date: Fri, 9 Apr 2021 12:12:57 -0700 Message-ID: Subject: Re: Problem in pfmemalloc skb handling in net/core/dev.c To: 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 9, 2021 at 4:50 AM Eric Dumazet wrote: > > On 4/9/21 12:14 PM, Xie He wrote: > > Then simply copy the needed logic. No, there's no such thing as "sockets" in some of the protocols. There is simply no way to 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() This is exactly what I'm talking about. "skb_pfmemalloc_protocol" cannot guarantee pfmemalloc skbs are not delivered to unrelated protocols, because "__netif_receive_skb" will sometimes treat pfmemalloc skbs as normal skbs. > 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. Yes, the code of "net/core/dev.c" has exactly this problem. It doesn't drop pfmemalloc skbs in some situations, and instead deliver them to unrelated protocols, which clearly have nothing to do with swapping. I'm not sure if you understand what I'm saying. Please look at the code of "__netif_receive_skb" and see what will happen when "sk_memalloc_socks()" is false and "skb_pfmemalloc(skb)" is true.