Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Tue, 2 Oct 2001 11:49:14 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Tue, 2 Oct 2001 11:48:57 -0400 Received: from gap.cco.caltech.edu ([131.215.139.43]:5825 "EHLO gap.cco.caltech.edu") by vger.kernel.org with ESMTP id ; Tue, 2 Oct 2001 11:48:33 -0400 Date: Tue, 2 Oct 2001 10:23:06 -0500 From: Tommy Reynolds To: "Dinesh Gandhewar" Cc: mlist-linux-kernel@nntp-server.caltech.edu Subject: Re: Message-Id: <20011002102306.49730a0b.reynolds@redhat.com> In-Reply-To: <20011002152945.15180.qmail@mailweb16.rediffmail.com> In-Reply-To: <20011002152945.15180.qmail@mailweb16.rediffmail.com> Organization: Red Hat Software, Inc. / Embedded Development X-Mailer: Sylpheed version 0.6.2cvs9 (GTK+ 1.2.9; ) X-Face: Nr)Jjr was pleased to say: > I have written a linux kernel module. The linux version is 2.2.14. > In this module I have declared an array of size 2048. If I use this array, the > execution of this module function causes kernel to reboot. If I kmalloc() this > array then execution of this module function doesnot cause any problem. > Can you explain this behaviour? Unlike userland application programming, the kernel stack does not grow: it has a fixed size. You are using too much stack space and corrupting your system. The kernel stack is quite small (less than 8K is available for ALL nested modules and interrupt handlers), so driver functions should use an absolute minimum of local variables, such as a pointer to a per-instance data area. Kernel-leval kmalloc() is efficient enough to use frequently. ---------------------------------------------+----------------------------- Tommy Reynolds | mailto: Red Hat, Inc., Embedded Development Services | Phone: +1.256.704.9286 307 Wynn Drive NW, Huntsville, AL 35805 USA | FAX: +1.236.837.3839 Senior Software Developer | Mobile: +1.919.641.2923 - 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/