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=-5.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 C8175C433E0 for ; Wed, 12 Aug 2020 12:01:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 72CCD207F7 for ; Wed, 12 Aug 2020 12:01:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PNs0HnXo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 72CCD207F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CC1EF6B00B1; Wed, 12 Aug 2020 08:01:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C746D8D0001; Wed, 12 Aug 2020 08:01:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B3C9B6B00B3; Wed, 12 Aug 2020 08:01:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 9F3E56B00B1 for ; Wed, 12 Aug 2020 08:01:15 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 586F82464 for ; Wed, 12 Aug 2020 12:01:15 +0000 (UTC) X-FDA: 77141776110.23.wheel35_470b1f226feb Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin23.hostedemail.com (Postfix) with ESMTP id 3909337A6F for ; Wed, 12 Aug 2020 12:01:09 +0000 (UTC) X-HE-Tag: wheel35_470b1f226feb X-Filterd-Recvd-Size: 5916 Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Wed, 12 Aug 2020 12:01:08 +0000 (UTC) Received: by mail-lj1-f195.google.com with SMTP id h19so1878896ljg.13 for ; Wed, 12 Aug 2020 05:01:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=8cTKu+htZubp78ZAwaP8QB3wTAzRATflGC/Oju/GBoQ=; b=PNs0HnXoIuQSavbuR0nZpPKuJBn7jkw38v5RX/DSe9X5e9VxM4THmkG34NZEXV1Omk OJ06uQdnDQ0ckzE2KoPkH2uanV08T0Zs2sNiK/1DdAYvs4bTU3ue+7Co0L5k2lfvQGcx scgluk9Xh0xuLEItbBpkfumfjOgz5Wa3Ibo+ShIC3BvUYpecSDjrlEJlWib90hAzu+Ew GShr3hJqmvcixrs+KRxCxo0k4lG2gEyf9M6ine7sHNWhSn0IynsQCRS3b4T8YGvX6s2D 8c8T8TFrPFn4EFB72EoXpDHCNVJCC+pDZ0xwbC2Ex5XACAHpsTDDJWDGQr2bizuszpgb IoMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=8cTKu+htZubp78ZAwaP8QB3wTAzRATflGC/Oju/GBoQ=; b=pRocE4dyoaJGkWIb9vu7TkRwPaPdk/MeW8BVSlChISHy84EXM+jcD6mJ2jOQKWbq2k UuRRpnomkDK+Ij9YRacLkXrgI3KM/XIoaX24zDyV+v1N4t4vK7H4EJ/LX0opcfCOYLvx ngvcvMT+/+QSZuISvP5/x+r9nmB+tMuStBjmKyAHIfIyJlki0GGGnIhO9D3ChKG6EWP/ qv4z7qfxkeEvFrECcHAeT+jEb0nkIIG5EhrSxWquwv4id3d2R/7HgHHvZcQ7om9OKJJd WwUQfp8H1TGp1kp9jyqWQnzdVLzrOIWewvuJtt8DWhW+4sqqR5DdxO8968dU3hfq1n6w Rl1w== X-Gm-Message-State: AOAM5333GhISaW/Jraz5jyo2fxSDcJ60rhtyVbjZ06WzhSJYo9lG8vDO QtWLB8WiwraecH8rdqqZNoE= X-Google-Smtp-Source: ABdhPJzYbg4UqNa6DvRtK4xe/DFexc1hdIB7+hv8LtGxv0zG6zIROOuT13ZFrpOtLkMp4cwkqsxHhQ== X-Received: by 2002:a2e:b4e1:: with SMTP id s1mr4942254ljm.433.1597233666372; Wed, 12 Aug 2020 05:01:06 -0700 (PDT) Received: from pc636 (h5ef52e31.seluork.dyn.perspektivbredband.net. [94.245.46.49]) by smtp.gmail.com with ESMTPSA id y21sm395029ljk.129.2020.08.12.05.01.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Aug 2020 05:01:05 -0700 (PDT) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Wed, 12 Aug 2020 14:01:03 +0200 To: Thomas Gleixner Cc: Michal Hocko , 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: <20200812120103.GA17445@pc636> 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> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Queue-Id: 3909337A6F X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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, Aug 12, 2020 at 01:38:35PM +0200, 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. > I suspect if you measure the latency of the zone->lock and its contention on any embedded device, i mean not powerful devices like PC, it could be milliseconds. IMHO. > > 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. > Initially i have not proposed to convert the lock, because i suspected that from the RT point of view there could be problems. Also, like i mentioned before, the GFP_ATOMIC is not meaningful anymore, that is a bit out of what GFP_ATOMIC stands for. But i see your point about "where is a stop line". That is why i proposed to bail out as later as possible: mm: Add __GFP_NO_LOCKS flag >From the other hand we have been discussing other options, like converting. Just to cover as much as possible :) Thanks Thomas for valuable comments! -- Vlad Rezki