From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30046C433E1 for ; Thu, 13 Aug 2020 07:18:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EBFD72078B for ; Thu, 13 Aug 2020 07:18:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EBFD72078B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 593916B000C; Thu, 13 Aug 2020 03:18:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 544C76B000D; Thu, 13 Aug 2020 03:18:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 45AAF6B000E; Thu, 13 Aug 2020 03:18:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0119.hostedemail.com [216.40.44.119]) by kanga.kvack.org (Postfix) with ESMTP id 302A36B000C for ; Thu, 13 Aug 2020 03:18:11 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id C9164180AD804 for ; Thu, 13 Aug 2020 07:18:10 +0000 (UTC) X-FDA: 77144691540.29.plant59_31008e926ff2 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin29.hostedemail.com (Postfix) with ESMTP id 9F94418086E40 for ; Thu, 13 Aug 2020 07:18:10 +0000 (UTC) X-HE-Tag: plant59_31008e926ff2 X-Filterd-Recvd-Size: 3449 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf04.hostedemail.com (Postfix) with ESMTP for ; Thu, 13 Aug 2020 07:18:10 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id E72A8ABF1; Thu, 13 Aug 2020 07:18:30 +0000 (UTC) Date: Thu, 13 Aug 2020 09:18:02 +0200 From: Michal Hocko To: Thomas Gleixner Cc: Uladzislau Rezki , LKML , RCU , linux-mm@kvack.org, Andrew Morton , Vlastimil Babka , "Paul E . McKenney" , Matthew Wilcox , "Theodore Y . Ts'o" , Joel Fernandes , Sebastian Andrzej Siewior , Oleksiy Avramchenko Subject: Re: [RFC-PATCH 1/2] mm: Add __GFP_NO_LOCKS flag Message-ID: <20200813071802.GC9477@dhcp22.suse.cz> References: <20200809204354.20137-1-urezki@gmail.com> <20200809204354.20137-2-urezki@gmail.com> <20200810123141.GF4773@dhcp22.suse.cz> <20200810160739.GA29884@pc636> <20200810192525.GG4773@dhcp22.suse.cz> <87pn7x6y4a.fsf@nanos.tec.linutronix.de> <87k0y56wc1.fsf@nanos.tec.linutronix.de> <87mu305c1w.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87mu305c1w.fsf@nanos.tec.linutronix.de> X-Rspamd-Queue-Id: 9F94418086E40 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed 12-08-20 13:38:35, Thomas Gleixner wrote: > Thomas Gleixner writes: > > Thomas Gleixner writes: > >> Michal Hocko writes: > >>> zone->lock should be held for a very limited amount of time. > >> > >> Emphasis on should. free_pcppages_bulk() can hold it for quite some time > >> when a large amount of pages are purged. We surely would have converted > >> it to a raw lock long time ago otherwise. > >> > >> For regular enterprise stuff a few hundred microseconds might qualify as > >> a limited amount of time. For advanced RT applications that's way beyond > >> tolerable.. > > > > Sebastian just tried with zone lock converted to a raw lock and maximum > > latencies go up by a factor of 7 when putting a bit of stress on the > > memory subsytem. Just a regular kernel compile kicks them up by a factor > > of 5. Way out of tolerance. > > > > We'll have a look whether it's solely free_pcppages_bulk() and if so we > > could get away with dropping the lock in the loop. > > So even on !RT and just doing a kernel compile the time spent in > free_pcppages_bulk() is up to 270 usec. > > It's not only the loop which processes a large pile of pages, part of it > is caused by lock contention on zone->lock. Dropping the lock after a > processing a couple of pages does not make it much better if enough CPUs > are contending on the lock. OK, this is a bit surprising to me but well, reality sucks sometimes. I was really hoping for a solution which would allow the allocator to really do what gfp flags say and if something is nowait then it shouldn't really block. I believe we need to document this properly. I will comment on the dedicated gfp flag in reply to other email. Thanks for trying that out Sebastian and Thomas! -- Michal Hocko SUSE Labs