Re: Kernel NFS lockd freezes notebook on shutdown (Linux 2.6.22-rc1 + CFS v12)

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andrew Morton
Date: Friday, May 18, 2007 - 8:34 am

On Fri, 18 May 2007 15:17:36 +0300 Zilvinas Valinskas <zilvinas@wilibox.com> wrote:



yup, thanks - the below patch will be in this evening's batch -> Linus.



From: Ben Collins <ben.collins@ubuntu.com>

kmalloc for flush_words resulted in zero size allocation when no
k8_northbridges existed.  Short circuit the code path for this case.

Also remove uneeded zeroing of num_k8_northbridges just after checking if
it is zero.

Signed-off-by: Ben Collins <bcollins@ubuntu.com>
Cc: Andi Kleen <ak@suse.de>
Cc: Dave Jones <davej@codemonkey.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 arch/x86_64/kernel/k8.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletion(-)

diff -puN arch/x86_64/kernel/k8.c~avoid-zero-size-allocation-in-cache_k8_northbridges arch/x86_64/kernel/k8.c
--- a/arch/x86_64/kernel/k8.c~avoid-zero-size-allocation-in-cache_k8_northbridges
+++ a/arch/x86_64/kernel/k8.c
@@ -39,10 +39,10 @@ int cache_k8_northbridges(void)
 {
 	int i;
 	struct pci_dev *dev;
+
 	if (num_k8_northbridges)
 		return 0;
 
-	num_k8_northbridges = 0;
 	dev = NULL;
 	while ((dev = next_k8_northbridge(dev)) != NULL)
 		num_k8_northbridges++;
@@ -52,6 +52,11 @@ int cache_k8_northbridges(void)
 	if (!k8_northbridges)
 		return -ENOMEM;
 
+	if (!num_k8_northbridges) {
+		k8_northbridges[0] = NULL;
+		return 0;
+	}
+
 	flush_words = kmalloc(num_k8_northbridges * sizeof(u32), GFP_KERNEL);
 	if (!flush_words) {
 		kfree(k8_northbridges);
_


Backtraces can be pretty messy nowadays.  CONFIG_FRAME_POINTER helps
improve them.

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Kernel NFS lockd freezes notebook on shutdown (Linux 2.6.2 ..., Zilvinas Valinskas, (Wed May 16, 11:00 am)
Re: Kernel NFS lockd freezes notebook on shutdown (Linux 2 ..., Zilvinas Valinskas, (Wed May 16, 11:17 pm)
Re: Kernel NFS lockd freezes notebook on shutdown (Linux 2 ..., Zilvinas Valinskas, (Thu May 17, 1:21 am)
Re: Kernel NFS lockd freezes notebook on shutdown (Linux 2 ..., Zilvinas Valinskas, (Thu May 17, 2:00 am)
Re: Kernel NFS lockd freezes notebook on shutdown (Linux 2 ..., Zilvinas Valinskas, (Fri May 18, 3:47 am)
Re: Kernel NFS lockd freezes notebook on shutdown (Linux 2 ..., Zilvinas Valinskas, (Fri May 18, 5:17 am)
Re: Kernel NFS lockd freezes notebook on shutdown (Linux 2 ..., Andrew Morton, (Fri May 18, 8:34 am)