Skip to contentSkip to conversation

msgsnd use freezable blocking call

PATCH Maninder Singh 1 participant 1 message May 7, 2015

lore
Share & tools
lore
#0 lore raw

EP-F6AA0618C49C4AEDA73BFF1B39950BAB

Quoted 12 lines · On Wed, 06 May 2015 11:29:57 +0000 (GMT) Maninder Singh wrote:
Quoted 11 lines

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

Quoted 6 lines
Quoted 1 line

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.

Quoted 7 lines

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?

When any task is stuck in Interruptible or Uninterruptible state then waking up of that task fails.
If wakeup fails, then suspend operation fails and all process send to frezeer state at this moment also gets wakeup.
Correct implementation is that if suspend fails, then kernel would retry suspend operation again after some specific timeinterval for some fixed retry count. But as changes suggested by Mr Colin Cross on LKML https://lkml.org/lkml/2013/5/1/424, for the system calls for which issue has been faced process flag being appended with PF_FREEZER_SKIP.

we are testing some scenerio in which we have to do multi suspend-resume scenario, and we faced the problem thats why suggested the change for msgsnd and msgrcv

Cc Yogesh Gaur <[email protected]>
Cc Manjeet Pawar <[email protected]>
Cc Ajeet Yadav <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Tejun Heo <[email protected]>

---

 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
diff -puN ipc/msg.c~ipc-msgc-msgsnd-use-freezable-blocking-call ipc/msg.c
@@ -673,7 +673,7 @@ long do_msgsnd(int msqid, long mtype, vo
 
 		ipc_unlock_object(&msq->q_perm);
 		rcu_read_unlock();
-		schedule();
+		freezable_schedule();
 
 		rcu_read_lock();
 		ipc_lock_object(&msq->q_perm);

_ ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ¥Šwÿº{.nÇ+‰·¥Š{±þG«�éÿŠ{ayºʇڙë,j­¢f£¢·hš�ï�êÿ‘êçz_è®(­éšŽŠÝ¢j"�ú¶m§ÿÿ¾«þG«�éÿ¢¸?™¨è­Ú&£ø§~�á¶iO•æ¬z·švØ^¶m§ÿÿà ÿ¶ìÿ¢¸?–I¥