msgsnd use freezable blocking call
PATCH 1/1 msgsnd use freezable blocking call
EP-F6AA0618C49C4AEDA73BFF1B39950BAB
Hi ,
Recently shared a patch for using freezable_schedule instead of schedule in msgrcv,
and after analysing message queuie implemntation we have realized even msgsnd can also block, if queue is full, So in this scenerio msgsnd sets task state as TASK_INTERRUPTIBLE and can schedule function, similar behaviour as msgrcv. This change is applicable for msgsnd as well.
we have created patch for remotes/linux-next/akpm, because msgrcv patch is already applied at this branch. so we didnt include <linux/freezer.h>
--- ipc/msg.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
ipc/msg.c +1 -1
@@ -674,7 +674,7 @@ long do_msgsnd(int msqid, long mtype, void __user *mtext,ipc_unlock_object (&msq->q_perm);rcu_read_unlock (); -schedule (); +freezable_schedule ();rcu_read_lock ();ipc_lock_object (&msq->q_perm);
Signature · 4 lines
1.7.1
Thanks and Regards,
Maninder Singhÿôèº{.nÇ+‰·Ÿ®‰†+%ŠËÿ±éݶ¥Šwÿº{.nÇ+‰·¥Š{±þG«�éÿŠ{ayºÊ‡Ú™ë,j¢f£¢·hš�ï�êÿ‘êçz_è®(階ŠÝ¢j"�ú¶m§ÿÿ¾«þG«�éÿ¢¸?™¨èÚ&£ø§~�á¶iO•æ¬z·švØ^¶m§ÿÿÃÿ¶ìÿ¢¸?–I¥Quoted 4 lines · On Wed, 06 May 2015 11:29:57 +0000 (GMT) Maninder Singh…
EP-F6AA0618C49C4AEDA73BFF1B39950BAB
Hi ,
Quoted 8 lines
Recently shared a patch for using
freezable_scheduleinstead of schedule in msgrcv,
and after analysing message queuie implemntation we have realized even msgsnd can also block, if queue is full, So in this scenerio msgsnd sets task state asTASK_INTERRUPTIBLEand can schedule function, similar behaviour as msgrcv. This change is applicable for msgsnd as well.we have created patch for remotes/linux-next/akpm, because msgrcv patch is already applied at this branch. so we didnt include <
linux/freezer.h>
This changelog is quite poor. It doesn't explain why the change is being made, it doesn't explain the user-visible effects which are being fixed, etc.
So I threw it away and copied text from "ipc/msg.c: use freezable blocking call":
One thing which isn't clear to me: *why* do we want to "Avoid waking up every thread sleeping in XXX during suspend and resume"? Suspend and resume are rare operations. Why do we care if a few threads wake up then go to sleep again?
From: Maninder Singh <[email protected]>
Subject: ipc/msg.c: msgsnd: use freezable blocking call
Avoid waking up every thread sleeping in a msgsnd call during suspend and resume by calling a freezable blocking call. Previous patches modified the freezer to avoid sending wakeups to threads that are blocked in freezable blocking calls.
This call was selected to be converted to a freezable call because it doesn't hold any locks or release any resources when interrupted that might be needed by another freezing task or a kernel driver during suspend, and is a common site where idle userspace tasks are blocked.
---
ipc/msg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ipc/msg.c renamed from ipc/msg.c~ipc-msgc-msgsnd-use-freezable-blocking-call +1 -1
@@ -673,7 +673,7 @@ long do_msgsnd(int msqid, long mtype, voipc_unlock_object (&msq->q_perm);rcu_read_unlock (); -schedule (); +freezable_schedule ();rcu_read_lock ();ipc_lock_object (&msq->q_perm);
_