Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1040970ybi; Fri, 2 Aug 2019 08:22:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqz8xj3K7b/EqTiaOhvyDMmtTG1M+++1VnzeDGQfqPCDdg5gDp5+M7OQ5iiHWbPusYnQkGY1 X-Received: by 2002:a17:90a:30cf:: with SMTP id h73mr4962935pjb.42.1564759361944; Fri, 02 Aug 2019 08:22:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564759361; cv=none; d=google.com; s=arc-20160816; b=NJtHI+38ogZBMe0okAWVs8Ipj3T4CmnPJ8oik1PnSYDpGClwY95A30UgpU1zj0n7gu cbFw+5wgojxiZGaPWEGhHoEEq1ZfcKevWgXEagfHweJkZgkiFZASlQE4KHLN8tTBSUDH o/z5loaF+UZ7iGlCQL+PLBua0LsFAOWy0LzPYwgsvtqrmCH/rviSH+5M5QdBe2xoGwJx jbxbMw+WnW61UuKr6gzzN/1R+GwOULdx8KS1IzwlZK73s65MkU459x602180NgDR4Wwf ej1E8eLPuZLnj7cHvfdnk/4JJNZlPSt6rvNZ9FW+h1WAmrdhRcbIvHWB9D/OqK7E0nok ZoNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=3D3mT8Hdds27dRq1XumagADjxjteQlLAsabw6LIVu+8=; b=Ve1Km3CInn3fV+2Ycf4bKpD8NLVSV6IcJw/veuV2mwmR0leCbmZJr+26BcwYYq1LUZ ZPKlFazXadvXlzHgJwLU5GmTBhHbLXO2qHc/dP9HTMd3JbwS1VU/A96g/ZZaNLc5WNaM SScxQAEI4Krd83+5KapWZith8bYehMLrKxwREFBDT3FaTWG033VpspYqmtMATuZHZr0C GrhxUGarwQ1TNSg1bYZtrJFPk+p+NCYdzLj0BBdJkIa/0gCj5ORwSdjML/C2O4rA7sPA Ts0ieidQ/zdYrPVVjmyRKHKibOYWzQh+5aioPWH388mNS/cwiJK+fWMB7e8OW4s5YsMB wzXQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t13si38749975pfh.245.2019.08.02.08.22.26; Fri, 02 Aug 2019 08:22:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391631AbfHBJfR (ORCPT + 99 others); Fri, 2 Aug 2019 05:35:17 -0400 Received: from mx2.suse.de ([195.135.220.15]:34402 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2391611AbfHBJfK (ORCPT ); Fri, 2 Aug 2019 05:35:10 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 12CB4AC7F; Fri, 2 Aug 2019 09:35:09 +0000 (UTC) Date: Fri, 2 Aug 2019 11:35:07 +0200 From: Michal Hocko To: Yang Shi Cc: Konstantin Khlebnikov , Linux MM , Linux Kernel Mailing List , cgroups@vger.kernel.org, Vladimir Davydov , Johannes Weiner Subject: Re: [PATCH RFC] mm/memcontrol: reclaim severe usage over high limit in get_user_pages loop Message-ID: <20190802093507.GF6461@dhcp22.suse.cz> References: <156431697805.3170.6377599347542228221.stgit@buzz> <20190729091738.GF9330@dhcp22.suse.cz> <3d6fc779-2081-ba4b-22cf-be701d617bb4@yandex-team.ru> <20190729103307.GG9330@dhcp22.suse.cz> <20190729184850.GH9330@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 01-08-19 14:00:51, Yang Shi wrote: > On Mon, Jul 29, 2019 at 11:48 AM Michal Hocko wrote: > > > > On Mon 29-07-19 10:28:43, Yang Shi wrote: > > [...] > > > I don't worry too much about scale since the scale issue is not unique > > > to background reclaim, direct reclaim may run into the same problem. > > > > Just to clarify. By scaling problem I mean 1:1 kswapd thread to memcg. > > You can have thousands of memcgs and I do not think we really do want > > to create one kswapd for each. Once we have a kswapd thread pool then we > > get into a tricky land where a determinism/fairness would be non trivial > > to achieve. Direct reclaim, on the other hand is bound by the workload > > itself. > > Yes, I agree thread pool would introduce more latency than dedicated > kswapd thread. But, it looks not that bad in our test. When memory > allocation is fast, even though dedicated kswapd thread can't catch > up. So, such background reclaim is best effort, not guaranteed. > > I don't quite get what you mean about fairness. Do you mean they may > spend excessive cpu time then cause other processes starvation? I > think this could be mitigated by properly organizing and setting > groups. But, I agree this is tricky. No, I meant that the cost of reclaiming a unit of charges (e.g. SWAP_CLUSTER_MAX) is not constant and depends on the state of the memory on LRUs. Therefore any thread pool mechanism would lead to unfair reclaim and non-deterministic behavior. I can imagine a middle ground where the background reclaim would have to be an opt-in feature and a dedicated kernel thread would be assigned to the particular memcg (hierarchy). -- Michal Hocko SUSE Labs