[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110426222157.33a461f8@notabene.brown>
Date: Tue, 26 Apr 2011 22:21:57 +1000
From: NeilBrown <neilb@...e.de>
To: Mel Gorman <mgorman@...e.de>
Cc: Linux-MM <linux-mm@...ck.org>,
Linux-Netdev <netdev@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
David Miller <davem@...emloft.net>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: Re: [PATCH 09/13] netvm: Set PF_MEMALLOC as appropriate during SKB
processing
On Tue, 26 Apr 2011 08:36:50 +0100 Mel Gorman <mgorman@...e.de> wrote:
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 3871bf6..2d79a20 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -3095,6 +3095,27 @@ static void vlan_on_bond_hook(struct sk_buff *skb)
> }
> }
>
> +/*
> + * Limit which protocols can use the PFMEMALLOC reserves to those that are
> + * expected to be used for communication with swap.
> + */
> +static bool skb_pfmemalloc_protocol(struct sk_buff *skb)
> +{
> + if (skb_pfmemalloc(skb))
> + switch (skb->protocol) {
> + case __constant_htons(ETH_P_ARP):
> + case __constant_htons(ETH_P_IP):
> + case __constant_htons(ETH_P_IPV6):
> + case __constant_htons(ETH_P_8021Q):
> + break;
> +
> + default:
> + return false;
> + }
> +
> + return true;
> +}
This sort of thing really bugs me :-)
Neither the comment nor the function name actually describe what the function
is doing. The function is checking *2* things.
is_pfmemalloc_skb_or_pfmemalloc_protocol()
might be a more correct name, but is too verbose.
I would prefer the skb_pfmemalloc test were removed from here and ....
> + if (!skb_pfmemalloc_protocol(skb))
> + goto drop;
> +
...added here so this becomes:
if (!skb_pfmemalloc(skb) && !skb_pfmemalloc_protocol(skb))
goto drop;
which actually makes sense.
Thanks,
NeilBrown
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists