From owner-freebsd-stable@freebsd.org Fri Dec 4 09:45:58 2015 Return-Path: Delivered-To: freebsd-stable@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 5FB09A40763 for ; Fri, 4 Dec 2015 09:45:58 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CAFAC1D34 for ; Fri, 4 Dec 2015 09:45:57 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id tB49jqa8050011 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Fri, 4 Dec 2015 11:45:52 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua tB49jqa8050011 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id tB49joc0049992; Fri, 4 Dec 2015 11:45:50 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 4 Dec 2015 11:45:50 +0200 From: Konstantin Belousov To: Gavin Mu Cc: freebsd-stable Subject: Re: application coredump behavior differences between FreeBSD 7.0 and FreeBSD 10.1 Message-ID: <20151204094550.GO2405@kib.kiev.ua> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) 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: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2015 09:45:58 -0000 On Fri, Dec 04, 2015 at 09:35:54AM +0800, Gavin Mu wrote: > Hi, > > We have an application running on old FreeBSD 7.0, and we are upgrading the base system to FreeBSD 10.1. The application uses sysv_shm, and will allocate a lot of share memory, though most of time only a part of the allocated memory is used. aka. large SIZE and small RES from /usr/bin/top view. > > When the application core dump, the core dump file will be large, and in FreeBSD 7.0, it uses only a little more memory to do core dump, but in FreeBSD 10.1, it seems all share memory are touched and uses a lot of physical memory (RES in /usr/bin/top output will increase very much) and cause memory drain. > > I have been debugging but can not find any clue yet. Could someone provide some points where the issue happen? Thanks. Both stable/7 and latest HEAD do read the whole mapped segment to write the coredump. This behaviour did not changed, since probably introduction of the ELF support into FreeBSD. And, how otherwise could coredump file contain the content of the mapped segments ? What in the FreeBSD 10 changed in this regard, is a deadlock fix which could occur in some scenarious, including the coredumping. In stable/7, the page instantiation or swap-in for pages accessed by the core write, was done while owning several VFS locks. This sometimes caused deadlock. In stable/10 the deadlock avoidance code is enabled by default, and when kernel detects the possibility of the deadlock, it changes to reading carefully by small chunks. Still, this does not explain the effect that you describe. In fact, I am more suspicious to the claim that stable/7 did not increase RSS of the dumping process or did not accessed the whole mapped shared segment, then the claim that there is a regression in stable/10.