Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp752384pxf; Thu, 8 Apr 2021 11:52:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgJo/i+U43PsdkNTV7xXSlFSp28MHvporWUtUNzwera5WmX/Dd3/31v5O1MVc0J+wqLKrB X-Received: by 2002:a17:902:be10:b029:e9:78a0:dd33 with SMTP id r16-20020a170902be10b02900e978a0dd33mr6837420pls.1.1617907977266; Thu, 08 Apr 2021 11:52:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617907977; cv=none; d=google.com; s=arc-20160816; b=tat2Hh3YQMubZXuYTWexfduirCC46KX0/WDqllAoM1AXLNpthJpTgEcBVtIftskHe7 gTBQnpZCo7F/JIgKe3whI2tsRVzt4fWBjoVccYiORLxYeps9COTfei/ga97694GYEq39 oJKmsYNst56He4NnjBYP26twjC3vYRQoceHdrFeh9RSrKhQvE/iiLV+T/I1PiRH2uS6V 97uqwKEjdR4QeRCrZPaVrf7eJ7GoOxUT309dPsJCBD1mpLoFZE3XWAyGIjm1d+NFftqk nq7FA/Z8GML72ZMumb/Tl2eLYdUgRMBa8132UuUPh+XJPECl0HT2p772smxMiHEnpjIx CieA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:subject:message-id:date:from:mime-version :dkim-signature; bh=vPVJuTnTZIpwD3zBSiZSHiPhLH2vt3JYwL7ismnrZC8=; b=S1GLl4ayhmjAPbDg3Tl3KsUUntjq5iYTYrgteGNp/CGleTFaeAtJ+tHkt/YLGETyO+ ZuRqpXhmqI+Eh46GAd93mRDMFWl29KFYhjw8jB3zFwzzcv/pFLyYticDltvYc4BFRP69 Sv6RZtTLt9JuHZD7li4ABtDZKnc4Ce8FOlgzitbiUA92d/2hAxg2Fmq+6jT0EmCqD6AH Yyc9VHKDU2huILAMCAI7n3Pty6/vaq/PWwPqGGUOYwI0omVxs0UPC1chjwU53at0kKzs iKKnldDbI/dURHSiBdu9QGZZkS+hjBsrWQ5KQBZarw5q2snyvmm8k+vHt1dtg1Styf3h oIWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=D9NSMZDi; 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 m16si191254pfk.193.2021.04.08.11.52.44; Thu, 08 Apr 2021 11:52:57 -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=D9NSMZDi; 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 S232841AbhDHSwY (ORCPT + 99 others); Thu, 8 Apr 2021 14:52:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231676AbhDHSwY (ORCPT ); Thu, 8 Apr 2021 14:52:24 -0400 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD709C061760; Thu, 8 Apr 2021 11:52:12 -0700 (PDT) Received: by mail-pf1-x431.google.com with SMTP id i190so2498725pfc.12; Thu, 08 Apr 2021 11:52:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=vPVJuTnTZIpwD3zBSiZSHiPhLH2vt3JYwL7ismnrZC8=; b=D9NSMZDi7yoUeJ0HXUrZNQAS3ZB9qUQUYzZ1fO39qkWPBQJQabRWuGLUMZmrALI0m6 TkyahbEi6l7duHXpZZ0+F6oXlSb+peNLAoc7FhhbnluxAwCrKqo1P1Ex55qdXXX7wNK0 Daus6yyeZoEatzxMqASAymz230Tn8TL5K4NyE9kNutb3wRTvTEk4sgYQbIlrFcdZcXfD d8STS8wFnPOXkN/VtshVtiHJFayW/h8ObdHClWv4WxOsmx2UC+SBzpplfMb2AsFPDRVh 1n0c9pGhArIYDJNa8pJOcA+315Bkg6x+LWVVZeMvYuDg9zb1LSnWXN9EAVnR8DsJLqDP VGog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=vPVJuTnTZIpwD3zBSiZSHiPhLH2vt3JYwL7ismnrZC8=; b=JYRJnWcA5fg+ibyglGOD1nl8nfhduZ+2rQ50c34VD0OJL3z1zKFY4qwGQ8+l0du6C4 dWZrJoOyBRD8ytL1N5pZm6oGZ5vtsSlGfs2iyjWgy+8/kpqcFapFQNy9La7fo8hy1Cfc RNIYrPw6juLmmH1Bmfr08cUXJ9+SFr6OVISh0526T/2qt0sEh8fuoPBSyR/sS+c6CXCk bkvk5uV03fboF8rkazQaGqyybbh/j1W2vJKQjFDEw/XSXp5zjPeH3NQZZJCBekQ88p7u dAVi/Y5cpBUaDO1S+iA7GlKOi1+gsJZgM4rM+XYwUUSV+n9qBr5KPmEddDO0Bw87Yo/P tv/w== X-Gm-Message-State: AOAM5327Yb7wikh2Z8c58kKEC7+cYgTcI4wfiPM4MMIhs4d1AOTBxHal 043y+NUV8atbzPPpUJNFyn9GoYI5sXS6OGlAaQ8= X-Received: by 2002:a62:5ac4:0:b029:22e:e8de:eaba with SMTP id o187-20020a625ac40000b029022ee8deeabamr8907459pfb.4.1617907931906; Thu, 08 Apr 2021 11:52:11 -0700 (PDT) MIME-Version: 1.0 From: Xie He Date: Thu, 8 Apr 2021 11:52:01 -0700 Message-ID: Subject: Problem in pfmemalloc skb handling in net/core/dev.c To: Mel Gorman , 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mel Gorman, I may have found a problem in pfmemalloc skb handling in net/core/dev.c. I see there are "if" conditions checking for "sk_memalloc_socks() && skb_pfmemalloc(skb)", and when the condition is true, the skb is handled specially as a pfmemalloc skb, otherwise it is handled as a normal skb. However, if "sk_memalloc_socks()" is false and "skb_pfmemalloc(skb)" is true, the skb is still handled as a normal skb. Is this correct? This might happen if "sk_memalloc_socks()" was originally true and has just turned into false before the check. Can this happen? I found the original commit that added the "if" conditions: commit b4b9e3558508 ("netvm: set PF_MEMALLOC as appropriate during SKB processing") The commit message clearly indicates pfmemalloc skbs shouldn't be delivered to taps (or protocols that don't support pfmemalloc skbs). However, if they are incorrectly handled as normal skbs, they could be delivered to those places. I'm not sure if my understanding is correct. Could you please help? Thank you!