From owner-svn-src-all@freebsd.org Mon Dec 11 09:19:56 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2673E8B5AB; Mon, 11 Dec 2017 09:19:55 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8E0317903B; Mon, 11 Dec 2017 09:19:55 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id vBB9JhYe048303 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 11 Dec 2017 11:19:47 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua vBB9JhYe048303 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id vBB9JhQQ048302; Mon, 11 Dec 2017 11:19:43 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 11 Dec 2017 11:19:43 +0200 From: Konstantin Belousov To: Conrad Meyer Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r326758 - in head/sys/i386: conf include Message-ID: <20171211091943.GF2272@kib.kiev.ua> References: <201712110432.vBB4WbnE021090@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201712110432.vBB4WbnE021090@repo.freebsd.org> User-Agent: Mutt/1.9.1 (2017-09-22) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Dec 2017 09:19:56 -0000 On Mon, Dec 11, 2017 at 04:32:37AM +0000, Conrad Meyer wrote: > Author: cem > Date: Mon Dec 11 04:32:37 2017 > New Revision: 326758 > URL: https://svnweb.freebsd.org/changeset/base/326758 > > Log: > i386: Bump KSTACK_PAGES default to match amd64 i386 is not amd64, the change is wrong. i386 has the word size two times smaller than amd64, which makes typical frame smaller by 30-40% over same code on amd64. Also i386 has much smaller available KVA size (tens of MB) and KVA fragmentation is both more severe and more fatal due to this. I expect that your change will make any non-trivial load which creates enough threads to either fail randomly or deadlock. If somebody tries to fit large load onto i386 machine, he must know what to do and how to configure the kernel to adapt to the load (which does not require the recompilation). > > Logically, extend r286288 to cover all threads, by default. > > The world has largely moved on from i386. Most FreeBSD users and developers > test on amd64 hardware. For better or worse, we have written a non-trivial > amount of kernel code that relies on stacks larger than 8 kB, and it "just > works" on amd64, so there has been little incentive to shrink it. > > amd64 had its KSTACK_PAGES bumped to 4 back in Peter's initial AMD64 commit, > r114349, in 2003. Since that time, i386 has limped along on a stack half > the size. We've even observed the stack overflows years ago, but neglected > to fix the issue; see the 20121223 and 20150728 entries in UPDATING. > > If anyone is concerned with this change, I suggest they configure their > AMD64 kernels with KSTACK_PAGES 2 and fix the fallout there first. Eugene > has identified a list of high stack usage functions in the first PR below. This suggestion is completely bogus. > > PR: 219476, 224218 > Reported by: eugen@, Shreesh Holla > Relnotes: maybe > Sponsored by: Dell EMC Isilon > > Modified: > head/sys/i386/conf/NOTES > head/sys/i386/include/param.h > > Modified: head/sys/i386/conf/NOTES > ============================================================================== > --- head/sys/i386/conf/NOTES Mon Dec 11 02:44:15 2017 (r326757) > +++ head/sys/i386/conf/NOTES Mon Dec 11 04:32:37 2017 (r326758) > @@ -968,7 +968,7 @@ device ndis > # KSTACK_PAGES is the number of memory pages to assign to the kernel > # stack of each thread. > > -options KSTACK_PAGES=3 > +options KSTACK_PAGES=5 > > # Enable detailed accounting by the PV entry allocator. > > > Modified: head/sys/i386/include/param.h > ============================================================================== > --- head/sys/i386/include/param.h Mon Dec 11 02:44:15 2017 (r326757) > +++ head/sys/i386/include/param.h Mon Dec 11 04:32:37 2017 (r326758) > @@ -113,7 +113,7 @@ > #define IOPAGES 2 /* pages of i/o permission bitmap */ > > #ifndef KSTACK_PAGES > -#define KSTACK_PAGES 2 /* Includes pcb! */ > +#define KSTACK_PAGES 4 /* Includes pcb! */ > #endif > #define KSTACK_GUARD_PAGES 1 /* pages of kstack guard; 0 disables */ > #if KSTACK_PAGES < 4