Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751930AbbEFWWM (ORCPT ); Wed, 6 May 2015 18:22:12 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:55617 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751119AbbEFWWK (ORCPT ); Wed, 6 May 2015 18:22:10 -0400 Date: Wed, 6 May 2015 15:22:09 -0700 From: Andrew Morton To: maninder1.s@samsung.com Cc: linux-kernel@vger.kernel.org, "v.narang@samsung.com" , "Rafael J. Wysocki" , Peter Zijlstra Subject: Re: [EDT][PATCH 1/1] msgsnd use freezable blocking call Message-Id: <20150506152209.4a88555e14dc069c9ced65f6@linux-foundation.org> In-Reply-To: <1403347040.147731430911797047.JavaMail.weblogic@epmlwas03a> References: <1403347040.147731430911797047.JavaMail.weblogic@epmlwas03a> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2813 Lines: 75 On Wed, 06 May 2015 11:29:57 +0000 (GMT) Maninder Singh wrote: > 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 > 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 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. Signed-off-by: Vaneet narang Signed-off-by: Maninder Singh Cc: Yogesh Gaur Cc: Manjeet Pawar Cc: Ajeet Yadav Cc: Peter Zijlstra Cc: Tejun Heo Signed-off-by: Andrew Morton --- ipc/msg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff -puN ipc/msg.c~ipc-msgc-msgsnd-use-freezable-blocking-call ipc/msg.c --- a/ipc/msg.c~ipc-msgc-msgsnd-use-freezable-blocking-call +++ a/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); _ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/