From patchwork Thu Jun 21 16:09:02 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 166347 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 642B8B6FA8 for ; Fri, 22 Jun 2012 02:09:48 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759518Ab2FUQJa (ORCPT ); Thu, 21 Jun 2012 12:09:30 -0400 Received: from Chamillionaire.breakpoint.cc ([80.244.247.6]:53428 "EHLO Chamillionaire.breakpoint.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759442Ab2FUQJ3 (ORCPT ); Thu, 21 Jun 2012 12:09:29 -0400 Received: from bigeasy by Chamillionaire.breakpoint.cc with local (Exim 4.72) (envelope-from ) id 1ShjwN-0005Rx-JD; Thu, 21 Jun 2012 18:09:03 +0200 Date: Thu, 21 Jun 2012 18:09:02 +0200 From: Sebastian Andrzej Siewior To: Mel Gorman Cc: Andrew Morton , Linux-MM , Linux-Netdev , LKML , David Miller , Neil Brown , Peter Zijlstra , Mike Christie , Eric B Munson Subject: Re: [PATCH 10/17] netvm: Allow skb allocation to use PFMEMALLOC reserves Message-ID: <20120621160902.GA6045@breakpoint.cc> References: <1340192652-31658-1-git-send-email-mgorman@suse.de> <1340192652-31658-11-git-send-email-mgorman@suse.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1340192652-31658-11-git-send-email-mgorman@suse.de> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, Jun 20, 2012 at 12:44:05PM +0100, Mel Gorman wrote: > index b534a1b..61c951f 100644 > --- a/include/linux/skbuff.h > +++ b/include/linux/skbuff.h > @@ -505,6 +506,15 @@ struct sk_buff { > #include > > > +#define SKB_ALLOC_FCLONE 0x01 > +#define SKB_ALLOC_RX 0x02 > + > +/* Returns true if the skb was allocated from PFMEMALLOC reserves */ > +static inline bool skb_pfmemalloc(struct sk_buff *skb) > +{ > + return unlikely(skb->pfmemalloc); > +} > + > /* > * skb might have a dst pointer attached, refcounted or not. > * _skb_refdst low order bit is set if refcount was _not_ taken > @@ -568,7 +578,7 @@ extern bool skb_try_coalesce(struct sk_buff *to, struct sk_buff *from, > diff --git a/net/core/skbuff.c b/net/core/skbuff.c > index 1d6ecc8..9a58dcc 100644 > --- a/net/core/skbuff.c > +++ b/net/core/skbuff.c > @@ -839,6 +900,13 @@ static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old) > skb_shinfo(new)->gso_type = skb_shinfo(old)->gso_type; > } > > +static inline int skb_alloc_rx_flag(const struct sk_buff *skb) > +{ > + if (skb_pfmemalloc((struct sk_buff *)skb)) > + return SKB_ALLOC_RX; > + return 0; > +} > + > /** > * skb_copy - create private copy of an sk_buff > * @skb: buffer to copy If merge this chunk Then you should be able to drop the case in skb_alloc_rx_flag() without adding a warning. Sebastian --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 6510a5d..2acfec9 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -510,7 +510,7 @@ struct sk_buff { #define SKB_ALLOC_RX 0x02 /* Returns true if the skb was allocated from PFMEMALLOC reserves */ -static inline bool skb_pfmemalloc(struct sk_buff *skb) +static inline bool skb_pfmemalloc(const struct sk_buff *skb) { return unlikely(skb->pfmemalloc); } diff --git a/net/core/skbuff.c b/net/core/skbuff.c index c44ab68..6ce94b5 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -852,7 +852,7 @@ static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old) static inline int skb_alloc_rx_flag(const struct sk_buff *skb) { - if (skb_pfmemalloc((struct sk_buff *)skb)) + if (skb_pfmemalloc(skb)) return SKB_ALLOC_RX; return 0; }