Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1226383pxf; Fri, 9 Apr 2021 03:18:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyuFUykRb1JG46x9mYeFEk6ALa9SGguxJcDJa1nwkYrOsFVmIEO3MiwEZI/ebudXkp7uCGH X-Received: by 2002:a50:8d8a:: with SMTP id r10mr4136068edh.132.1617963531668; Fri, 09 Apr 2021 03:18:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617963531; cv=none; d=google.com; s=arc-20160816; b=Z3icb8bp0SS2UdBP6N48vz12HE/kOoq5yEQ96VmvE7JrfO/zD1h4P5+M5NBavzasVa E1vwQg3dybkyZ7aTy53edPiC57sMGzdMMtBdOTk2YmgUtllnOJ/zhMUny4TG+wB7RPYn 3J3YQRW60vCBmN8gRcxB/9SESXll7Y/kv0Xe9qf9GIXAX5SVbNSZkmeG96hQel5poEr7 MnxyZLV4QEgRURQRd9DV1YsSmzitDp9+8Fcp65zh2KxLXFDS2DxT3LPJJcXpGNWxxv3a kRknzy0HW934kV1rIhEKGs7xxh0JzbF2Kb2k6r6mZgXm15L/3GZFqekfmpcM+DPuUZkh 4hcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=NSfrVBc4gnBnGyMOAUSWxE3ofLPQlOdazdZ0AK5gUrs=; b=z4qq4gVS9UWYPv5ygEnH9UHR5taalpR+4cAfi5WgNr7ErtX/cZ1gYyGdZ6VOBCZY9v FUZT2PngMoiP5qetu2nVSvxbYvUYiykEEgq+me7vONUQJdoim3MeDMTm4emYX+HAN4Ec uQPs8iOfv1S+LS8lesp7hZSTzVxaHuETvc56EOkWpfJEd5EOynZnTpLYOuzKfE655jI4 oXuY+AEpKta7Nu55H1bmDSks3R5lAbMTsLqmHtZc3mBHidKP0p8b4Di7TBdddlwAM6+K 1FTN3xp503YbdhW17BztSneitOgCcOWTP4tYk1wlsfVsixi1385lGTfU4AKPTkLHqF6l chSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ttz2xBus; 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 ds10si1820764ejc.415.2021.04.09.03.18.29; Fri, 09 Apr 2021 03:18:51 -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=ttz2xBus; 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 S234875AbhDIKPZ (ORCPT + 99 others); Fri, 9 Apr 2021 06:15:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234341AbhDIKF6 (ORCPT ); Fri, 9 Apr 2021 06:05:58 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18924C0613DB; Fri, 9 Apr 2021 03:04:16 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id x7so5028253wrw.10; Fri, 09 Apr 2021 03:04:16 -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=NSfrVBc4gnBnGyMOAUSWxE3ofLPQlOdazdZ0AK5gUrs=; b=ttz2xBuswd45OqpQMqSaIZwwr8oh/lyTBNV3o43u0Uy1iEYgI19nT/2tBGpxkNjEzu pcC/WrSwR4/wRE+2ayZ2Tq+2pM8DFZEgzIfvTp8wMQjWTIvdFI3bio8YmYqW6snx9XMH uHQzoQb30spuptwToPUdXaWagBpSvKx97ipzyZgl3x3Njd66ThKp1/rSEPFvSQxcwSwt unlAuTwM3RUiDQQDdJHDb89+/qGpNR5KY4C5+4Cmpb6p2EMZIxERS6IYMHzjgz+aXgGj 5yWjHxfyxIZdfs1hgO5t5ea04JqARZ/q+NOc/VfnM6QAZa+jE9Ti/xThrgKtqFpUmSjL P40g== 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=NSfrVBc4gnBnGyMOAUSWxE3ofLPQlOdazdZ0AK5gUrs=; b=mGrFK8rXC9KI0444D1Zd3hEQ9msf6207VtuXLG3fPG97qKIMVYDewoNNlyg63jbqVj UKW/8WpK/UpQwiVJG23bbMTsGUgGqntuZ0wpr0r1Gue6cfp2kQ9Qw7EbttwkVzxD1xq5 cpQ2RB+Fr3A4JsnYovW8lH7lwi0z2Ruro7UYLgkoMBnUvkCJDNsFEMEDBslY/JKW5g5i 8wvhkclM7xS1rPiiJ/YATUX8WB5Yy82wkDTLxD4gditBgFxY1VADYCJ9JAuOvXM5549c I+xDhV6sMWpCNYisovGwwT+yKJEkiXwSYou85FEujfY9/yKZgItYU+fUYtFNv6FzEA/r 8ujQ== X-Gm-Message-State: AOAM531bHJa4kh2QGh4qTYy62AU5IGSzspdh2J2Hi1AzaAakhSZ28tRU LFZ0ZVZf1wNups1UboPxxzGxetuTfXI= X-Received: by 2002:adf:f88a:: with SMTP id u10mr17072590wrp.162.1617962654622; Fri, 09 Apr 2021 03:04:14 -0700 (PDT) Received: from [192.168.1.101] ([37.167.116.29]) by smtp.gmail.com with ESMTPSA id b1sm932241wru.90.2021.04.09.03.04.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Apr 2021 03:04:13 -0700 (PDT) Subject: Re: Problem in pfmemalloc skb handling in net/core/dev.c To: Xie He , Mel Gorman Cc: Mel Gorman , jslaby@suse.cz, Neil Brown , Peter Zijlstra , Mike Christie , Eric B Munson , Eric Dumazet , 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> From: Eric Dumazet Message-ID: <87ab3d13-f95d-07c5-fc6a-fb33e32685e5@gmail.com> Date: Fri, 9 Apr 2021 12:04:11 +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 11:14 AM, Xie He wrote: > On Fri, Apr 9, 2021 at 1:44 AM Mel Gorman wrote: >> >> That would imply that the tap was communicating with a swap device to >> allocate a pfmemalloc skb which shouldn't happen. Furthermore, it would >> require the swap device to be deactivated while pfmemalloc skbs still >> existed. Have you encountered this problem? > > I'm not a user of swap devices or pfmemalloc skbs. I just want to make > sure the protocols that I'm developing (not IP or IPv6) won't get > pfmemalloc skbs when receiving, because those protocols cannot handle > them. > > According to the code, it seems always possible to get a pfmemalloc > skb when a network driver calls "__netdev_alloc_skb". The skb will > then be queued in per-CPU backlog queues when the driver calls > "netif_rx". There seems to be nothing preventing "sk_memalloc_socks()" > from becoming "false" after the skb is allocated and before it is > handled by "__netif_receive_skb". > > Do you mean that at the time "sk_memalloc_socks()" changes from "true" > to "false", there would be no in-flight skbs currently being received, > and all network communications have been paused? > Note that pfmemalloc skbs are normally dropped in sk_filter_trim_cap() Simply make sure your protocol use it.