From owner-svn-src-user@freebsd.org Mon May 23 17:37:36 2016 Return-Path: Delivered-To: svn-src-user@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 B887EB47266 for ; Mon, 23 May 2016 17:37:36 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-pa0-x232.google.com (mail-pa0-x232.google.com [IPv6:2607:f8b0:400e:c03::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8A49710CC; Mon, 23 May 2016 17:37:36 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-pa0-x232.google.com with SMTP id tb2so47706139pac.2; Mon, 23 May 2016 10:37:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=0qrNyK2oAyNdX2Wsyoo9hOgUqnAOU9lIUxRLxnLKPiM=; b=VC/j1wPwLUxgdOxe3SnfQNtcJEpoGToBADsYYegwgsd7Uk46TGclfdxA9zAN/clUyP 6I6sfj+NZOjjLn+0x1jLzWQ6nccswZZV5C3SgkheoAVY/mET3jcegfis/59yL5SRoAsi TQ56m40PnIzOpsPRd6YcMpFGFunZkYU3VV8pYXIVpc4NSFa17lALq32KbyHuofYkoZ5Y HeQg2b3sd20DVfZiz0AgK6NRU8ziGxED8PjpCT8dKv4wvRmZe9nEG0+LlyopJgHzMM9I bU+mk2tv0R9g8qsENdha0f4o3B1Zht0eC8KyF1IuLbV+fQkBUxFP01B6J9rmyYY7Bmfn xEGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=0qrNyK2oAyNdX2Wsyoo9hOgUqnAOU9lIUxRLxnLKPiM=; b=lC4ZuDtI1oLXyEoiEDkeeVqSj00RVrZssgbIlwolu/ZwtMQF3evW4ptnLc5t88W4Jd HBrOWyvZORVaEbZ65P8Sew9vill8q6PYnjGfLiEPvO8Ev9MGgwmD/7oLm2ICxSPQxRzT fkjnOMlDnun/w6uflcRpQ/vGakJtt96lL5ENzqbR4R6mRhwvH6zN3TI1g8HVoNdskq3R HZ+fCnb8jXXBqrDu+67s2dwaFJS3ILYvN0UuGnxN6PdOd/s5vDAEhbI6hignB3X0UOWG 60FNrqnrcHP9ADeHVXgNkJ3lMIXI8+iNSkUIVOoV3MkHoL7RSd4clhZOSyKPqbMOGSP4 LLvw== X-Gm-Message-State: ALyK8tIcI/JUSHg9I4tAKpzDsmL97rJmFtMw1VlUVNXd0dAZqF+3FwYBaXRqfSm+fvzOOg== X-Received: by 10.66.82.8 with SMTP id e8mr58794pay.124.1464025055405; Mon, 23 May 2016 10:37:35 -0700 (PDT) Received: from wkstn-mjohnston.west.isilon.com (c-76-104-201-218.hsd1.wa.comcast.net. [76.104.201.218]) by smtp.gmail.com with ESMTPSA id lz5sm48239627pab.34.2016.05.23.10.37.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 May 2016 10:37:34 -0700 (PDT) Sender: Mark Johnston Date: Mon, 23 May 2016 10:40:46 -0700 From: Mark Johnston To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r300465 - user/alc/PQ_LAUNDRY/sys/vm Message-ID: <20160523174046.GB51657@wkstn-mjohnston.west.isilon.com> References: <201605230528.u4N5S34B088158@repo.freebsd.org> <20160523124913.GU89104@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160523124913.GU89104@kib.kiev.ua> User-Agent: Mutt/1.6.1 (2016-04-27) X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 17:37:36 -0000 On Mon, May 23, 2016 at 03:49:13PM +0300, Konstantin Belousov wrote: > On Mon, May 23, 2016 at 05:28:03AM +0000, Mark Johnston wrote: > > Author: markj > > Date: Mon May 23 05:28:03 2016 > > New Revision: 300465 > > URL: https://svnweb.freebsd.org/changeset/base/300465 > > > > Log: > > Address over-eager OOM kills. > > > > Prior to this change, vm_page_free_wakeup() and thus vm_page_free() would > > clear vm_pages_needed when the free page count is above v_free_min. If the > > pagedaemon is starved for pages to reclaim because of a runaway process or > > because all inactive pages are dirty, but other threads are occasionally > > freeing pages, and v_free_min <= v_free_count <= vm_pageout_wakeup_thresh, > > concurrent vm_page_free() and vm_page_alloc() calls will respectively clear > > and set vm_pages_needed, waking up the pagedaemon in the process. This can > > cause the domain's oom_seq value to increment very quickly, leading to a > > spurious OOM kill when the pagedaemon cannot find clean pages to reclaim in > > the time that it takes for some pages to be laundered. > > > > This can be triggered during multiple consecutive sysbench runs when it > > writes mmap'ed files that are larger than system memory. > > > > Fix the problem by modifying vm_page_free_wakeup() to only clear > > vm_pages_needed once v_free_count has risen above vm_pageout_wakeup_thresh. > > > > Reviewed by: alc > > > > Modified: > > user/alc/PQ_LAUNDRY/sys/vm/vm_page.c > > > > Modified: user/alc/PQ_LAUNDRY/sys/vm/vm_page.c > > ============================================================================== > > --- user/alc/PQ_LAUNDRY/sys/vm/vm_page.c Mon May 23 05:28:02 2016 (r300464) > > +++ user/alc/PQ_LAUNDRY/sys/vm/vm_page.c Mon May 23 05:28:03 2016 (r300465) > > @@ -2910,7 +2910,8 @@ vm_page_free_wakeup(void) > > * lots of memory. this process will swapin processes. > > */ > > if (vm_pages_needed && !vm_page_count_min()) { > > - vm_pages_needed = 0; > > + if (!vm_paging_needed()) > > + vm_pages_needed = 0; > > wakeup(&vm_cnt.v_free_count); > > } > > } > > I looked at this change for some time after you referenced it. Can this > occur on the stoxk HEAD ? At least I do not see why it cannot, from the > description. I agree - in principle this problem exists in HEAD as well. I haven't been able to trigger the spurious OOM kills there, but I also haven't spent much time trying to do so, and my test case will occasionally result in a low-memory deadlock on HEAD instead. In my test case, the pagedaemon would block while laundering pages (since the vnode pager's putpages operation is synchronous when memory is low), so I suspect that it is generally able to launder and free some pages before hitting the oom_seq threshold.