lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 21 Jun 2012 18:09:02 +0200
From:	Sebastian Andrzej Siewior <sebastian@...akpoint.cc>
To:	Mel Gorman <mgorman@...e.de>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Linux-MM <linux-mm@...ck.org>,
	Linux-Netdev <netdev@...r.kernel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	David Miller <davem@...emloft.net>, Neil Brown <neilb@...e.de>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Mike Christie <michaelc@...wisc.edu>,
	Eric B Munson <emunson@...bm.net>
Subject: Re: [PATCH 10/17] netvm: Allow skb allocation to use PFMEMALLOC
 reserves

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 <linux/slab.h>
>  
>  
> +#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

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;
 }


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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ