Patch "tipc: allocate user memory with GFP_KERNEL flag" has been added to the 4.9-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
tipc: allocate user memory with GFP_KERNEL flag
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
tipc-allocate-user-memory-with-gfp_kernel-flag.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From foo@baz Mon Jul 3 13:37:32 CEST 2017
From: Parthasarathy Bhuvaragan <[email protected]>
Date: Fri, 13 Jan 2017 15:46:25 +0100
Subject: tipc: allocate user memory with GFP_KERNEL flag
From: Parthasarathy Bhuvaragan <[email protected]>
[ Upstream commit 57d5f64d83ab5b5a5118b1597386dd76eaf4340d ]
Until now, we allocate memory always with GFP_ATOMIC flag. When the system is under memory pressure and a user tries to send, the send fails due to low memory. However, the user application can wait for free memory if we allocate it using GFP_KERNEL flag.
In this commit, we use allocate memory with GFP_KERNEL for all user allocation.
--- net/tipc/discover.c | 4 ++-- net/tipc/link.c | 2 +- net/tipc/msg.c | 16 ++++++++-------- net/tipc/msg.h | 2 +- net/tipc/name_distr.c | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-)
net/tipc/discover.c +2 -2
@@ -169,7 +169,7 @@ void tipc_disc_rcv(struct net *net, stru/* Send response, if necessary */ if (respond && (mtyp ==DSC_REQ_MSG )) { - rskb =tipc_buf_acquire (MAX_H_SIZE ); + rskb =tipc_buf_acquire (MAX_H_SIZE ,GFP_ATOMIC );if (!rskb)return ;tipc_disc_init_msg (net, rskb,DSC_RESP_MSG , bearer);
@@ -278,7 +278,7 @@ int tipc_disc_create(struct net *net, st req =kmalloc (sizeof (*req),GFP_ATOMIC );if (!req)return -ENOMEM ; - req->buf =tipc_buf_acquire (MAX_H_SIZE ); + req->buf =tipc_buf_acquire (MAX_H_SIZE ,GFP_ATOMIC );if (!req->buf) {kfree (req);return -ENOMEM ;
net/tipc/link.c +1 -1
@@ -1395,7 +1395,7 @@ tnl:msg_set_seqno (hdr, seqno++); pktlen =msg_size (hdr);msg_set_size (&tnlhdr, pktlen +INT_H_SIZE ); - tnlskb =tipc_buf_acquire (pktlen +INT_H_SIZE ); + tnlskb =tipc_buf_acquire (pktlen +INT_H_SIZE ,GFP_ATOMIC );if (!tnlskb) {pr_warn ("%sunable to send packet\n" , link_co_err);return ;
net/tipc/msg.c +8 -8
@@ -58,12 +58,12 @@ static unsigned int align(unsigned int i* NOTE: Headroom is reserved to allow prepending of a data link header. * There may also be unrequested tailroom present at the buffer's end. */ -struct sk_buff *tipc_buf_acquire (u32 size) +struct sk_buff *tipc_buf_acquire (u32 size,gfp_t gfp) {struct sk_buff *skb;unsigned int buf_size = (BUF_HEADROOM + size +3 ) & ~3u ; - skb =alloc_skb_fclone (buf_size,GFP_ATOMIC ); + skb =alloc_skb_fclone (buf_size, gfp);if (skb) {skb_reserve (skb,BUF_HEADROOM );skb_put (skb, size);
@@ -95,7 +95,7 @@ struct sk_buff *tipc_msg_create(uint usestruct tipc_msg *msg;struct sk_buff *buf; - buf =tipc_buf_acquire (hdr_sz + data_sz); + buf =tipc_buf_acquire (hdr_sz + data_sz,GFP_ATOMIC );if (unlikely (!buf))return NULL ;
@@ -261,7 +261,7 @@ int tipc_msg_build(struct tipc_msg *mhdr/* No fragmentation needed? */ if (likely (msz <= pktmax)) { - skb =tipc_buf_acquire (msz); + skb =tipc_buf_acquire (msz,GFP_KERNEL );if (unlikely (!skb))return -ENOMEM ;skb_orphan (skb);
@@ -282,7 +282,7 @@ int tipc_msg_build(struct tipc_msg *mhdrmsg_set_importance (&pkthdr,msg_importance (mhdr));/* Prepare first fragment */ - skb =tipc_buf_acquire (pktmax); + skb =tipc_buf_acquire (pktmax,GFP_KERNEL );if (!skb)return -ENOMEM ;skb_orphan (skb);
@@ -313,7 +313,7 @@ int tipc_msg_build(struct tipc_msg *mhdr pktsz = drem +INT_H_SIZE ; else pktsz = pktmax; - skb =tipc_buf_acquire (pktsz); + skb =tipc_buf_acquire (pktsz,GFP_KERNEL );if (!skb) { rc = -ENOMEM ; goto error;
@@ -448,7 +448,7 @@ bool tipc_msg_make_bundle(struct sk_buffif (msz > (max /2 ))return false; - _skb =tipc_buf_acquire (max); + _skb =tipc_buf_acquire (max,GFP_ATOMIC );if (!_skb)return false;
@@ -496,7 +496,7 @@ bool tipc_msg_reverse(u32 own_node, str/* Never return SHORT header; expand by replacing buffer if necessary */ if (msg_short (hdr)) { - *skb =tipc_buf_acquire (BASIC_H_SIZE + dlen); + *skb =tipc_buf_acquire (BASIC_H_SIZE + dlen,GFP_ATOMIC );if (!*skb) goto exit;memcpy ((*skb)->data +BASIC_H_SIZE ,msg_data (hdr), dlen);
net/tipc/msg.h +1 -1
@@ -820,7 +820,7 @@ static inline bool msg_is_reset(struct treturn (msg_user (hdr) ==LINK_PROTOCOL ) && (msg_type (hdr) ==RESET_MSG ); } -struct sk_buff *tipc_buf_acquire (u32 size); +struct sk_buff *tipc_buf_acquire (u32 size,gfp_t gfp);bool tipc_msg_validate (struct sk_buff *skb);bool tipc_msg_reverse (u32 own_addr,struct sk_buff **skb,int err); void tipc_msg_init(u32 own_addr, struct tipc_msg *m, u32 user, u32 type,
net/tipc/name_distr.c +1 -1
@@ -69,7 +69,7 @@ static struct sk_buff *named_prepare_buf u32 dest) {struct tipc_net *tn =net_generic (net, tipc_net_id); -struct sk_buff *buf =tipc_buf_acquire (INT_H_SIZE + size); +struct sk_buff *buf =tipc_buf_acquire (INT_H_SIZE + size,GFP_ATOMIC );struct tipc_msg *msg;if (buf !=NULL ) {
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/tipc-allocate-user-memory-with-gfp_kernel-flag.patch