All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] ipc: use GFP_ATOMIC under spin lock
@ 2020-04-28  3:47 ` Wei Yongjun
  0 siblings, 0 replies; 12+ messages in thread
From: Wei Yongjun @ 2020-04-28  3:47 UTC (permalink / raw)
  To: Pankaj Bharadiya, Matthew Wilcox (Oracle),
	Andrew Morton, Waiman Long, Manfred Spraul, Stephen Rothwell,
	Alexey Dobriyan
  Cc: Wei Yongjun, linux-kernel, kernel-janitors

The function ipc_id_alloc() is called from ipc_addid(), in which
a spin lock is held, so we should use GFP_ATOMIC instead.

Fixes: de5738d1c364 ("ipc: convert ipcs_idr to XArray")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 ipc/util.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ipc/util.c b/ipc/util.c
index 723dc4b05208..093b31993d39 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -241,7 +241,7 @@ static inline int ipc_id_alloc(struct ipc_ids *ids, struct kern_ipc_perm *new)
 					xas.xa_index;
 			xas_store(&xas, new);
 			xas_clear_mark(&xas, XA_FREE_MARK);
-		} while (__xas_nomem(&xas, GFP_KERNEL));
+		} while (__xas_nomem(&xas, GFP_ATOMIC));
 
 		xas_unlock(&xas);
 		err = xas_error(&xas);
@@ -250,7 +250,7 @@ static inline int ipc_id_alloc(struct ipc_ids *ids, struct kern_ipc_perm *new)
 		new->id = get_restore_id(ids);
 		new->seq = ipcid_to_seqx(new->id);
 		idx = ipcid_to_idx(new->id);
-		err = xa_insert(&ids->ipcs, idx, new, GFP_KERNEL);
+		err = xa_insert(&ids->ipcs, idx, new, GFP_ATOMIC);
 		if (err == -EBUSY)
 			err = -ENOSPC;
 		set_restore_id(ids, -1);




^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-04-29 13:08 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-28  3:47 [PATCH -next] ipc: use GFP_ATOMIC under spin lock Wei Yongjun
2020-04-28  3:47 ` Wei Yongjun
2020-04-28 11:14 ` Matthew Wilcox
2020-04-28 11:14   ` Matthew Wilcox
2020-04-29  0:14   ` Andrew Morton
2020-04-29  0:14     ` Andrew Morton
2020-04-29  1:48     ` Matthew Wilcox
2020-04-29  1:48       ` Matthew Wilcox
2020-04-29  5:22   ` Manfred Spraul
2020-04-29  5:22     ` Manfred Spraul
2020-04-29 13:08     ` Matthew Wilcox
2020-04-29 13:08       ` Matthew Wilcox

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.