Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5249648ybl; Tue, 27 Aug 2019 01:33:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqwjrfOLlopMZ37Mbr4+ALiuoePX9R9ch8PzVDmkP+p248FUSAWhzJg99ByZz2bvNwM6QhiI X-Received: by 2002:a63:f941:: with SMTP id q1mr20302409pgk.350.1566894814757; Tue, 27 Aug 2019 01:33:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566894814; cv=none; d=google.com; s=arc-20160816; b=Nt65FNdXHxenLSPIigyokDIAPZWythblsLYlaR8oWyObRrPhcOA/aL6VmVhuwQxkHe svviuHytQ0WNfwQ/hVCPDU0v7d7UdZrMIir31q5xjWLuv1bxkCRoczcQ3r8YESXKVAXx L0tYLOlIQ+PS9meD42KSOC4KIaTspkJfK5qSsqAP8iILoK/9wQ+C3UJ4Vnw5i0f+TmYk G9+aWhEnwm5uTVwN8psxHzmb3KADM+uUONS5R57j+Yg4CS1hXV+skHEMVMMh8gut62c4 S0I16AAOVwQ0/dMN+HGpAx35OZgCHT1UbqB6iXr6U/5LZzpPKCZhxohYmxIJS/011Zcy Qo8w== 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:dkim-signature; bh=mn5KDVhwwChGG6/LPdXL9ASx19vYGpyQz4cnp0ZsO64=; b=U6/HEWMS6gAXjbn/6p8TEtajpzhuTjIjV+BDgGE/6xuoDeNosXBaeB7i09qwCv20K+ LmiOA0nh25wsEefc7QNEPSjCymmg4HsRIUDmMChFLl/tk2EOmUJywACffZj7V2LctYxF n8E9jZVKmb5NAT6Yk9R5hk0S6pYi5XP3EFjhHsQ5RCbrIa1J9l5QDn2a+2h7Ze33kRRj Bu2+lKCUCBlqj9BEvhQetKZV1wgSY3T3+5fa4AThZRjw/e3pn55GaZSi2R/T1iPAgYIO S5UgZZ2jd7Sj28wvCneeOAkp89bnZL/QboJ9KJTxX7NF86avR3HPty+sc1ez5EVUt1rL aIXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=nN9GaP2q; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u1si2025078pjn.73.2019.08.27.01.33.18; Tue, 27 Aug 2019 01:33:34 -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; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=nN9GaP2q; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729252AbfH0IcQ (ORCPT + 99 others); Tue, 27 Aug 2019 04:32:16 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:46394 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726071AbfH0IcQ (ORCPT ); Tue, 27 Aug 2019 04:32:16 -0400 Received: by mail-ed1-f65.google.com with SMTP id z51so30182184edz.13 for ; Tue, 27 Aug 2019 01:32:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=mn5KDVhwwChGG6/LPdXL9ASx19vYGpyQz4cnp0ZsO64=; b=nN9GaP2qDNZuPmqS08OSMU8Huq4aCRmmZzhT8DnxntN2vffDdHKBjdGhJzXFYocIl8 6xVlrvQc4enclmZw83Vw1fcat6UOLNMQKAvGhvneyZ5ra6oZOv0Wh0jfirxdN8gT0ZWn /r/nUCayxZSNmEMi7S0LIVVdMNXXRZitVMUVXLAEuU8JeqBKGaqKCNgMVTWHyXk+aC4K uxDyJeFSFoId3Irrcu7auJg4oxQ415pQVawtyC065Ahb/w2P0CxpMuIyB0Zm18Lc+Qio F6gJIICJ5WW0rT67I4N9eIt6kowvkiI3G65jmnTsGEF+FJF+HNMC3BTXA8IUb/bN7Tri FWVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=mn5KDVhwwChGG6/LPdXL9ASx19vYGpyQz4cnp0ZsO64=; b=nWL5brpz3c4APHCde4VoLOeQLPyLIuvAh8vwuwBYEZTjdW/RslNjqRUvK8IRrDuPx9 Nv0o2aCSJ2LrDxhP1Nii71e5mh+hMzQtAQBIf5LhP3vVzwDbfiMxz+uFFw4HRDqpzWIW Tv2/oH4C8p8PczIPCrkji3TGL8F+2LhDryJ98y/UudoFBg+5JKuifJXXqIb/sR2K0aHe QYuSHV853uzKK+wNo6ohl3k/vCBxFizd4j7Evpr7TPq9CZ9ynvhbmABOxpw1bkNUvPis 1HkYfy2hMTKnoRpzB+GvXtyjcQ7LzRjLFVjgE575u3qJ/WTWynj9isZOJzs2R/HPpqD/ Nahg== X-Gm-Message-State: APjAAAWbjoiAQlrO4YXPrlUqYLXfqzJ3O5kYo/2nCSm2fi7d898teoQG MjoEkp+/8eYmFNQkRSgiKic8mC34D7U= X-Received: by 2002:a17:906:5391:: with SMTP id g17mr20529475ejo.61.1566894734382; Tue, 27 Aug 2019 01:32:14 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id q10sm3413891ejt.54.2019.08.27.01.32.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Aug 2019 01:32:13 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id C1EEA100746; Tue, 27 Aug 2019 11:32:15 +0300 (+03) Date: Tue, 27 Aug 2019 11:32:15 +0300 From: "Kirill A. Shutemov" To: Michal Hocko Cc: Yang Shi , kirill.shutemov@linux.intel.com, hannes@cmpxchg.org, vbabka@suse.cz, rientjes@google.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [v2 PATCH -mm] mm: account deferred split THPs into MemAvailable Message-ID: <20190827083215.lrgaonueazq7etl5@box> References: <1566410125-66011-1-git-send-email-yang.shi@linux.alibaba.com> <20190822080434.GF12785@dhcp22.suse.cz> <9e4ba38e-0670-7292-ab3a-38af391598ec@linux.alibaba.com> <20190826074350.GE7538@dhcp22.suse.cz> <416daa85-44d4-1ef9-cc4c-6b91a8354c79@linux.alibaba.com> <20190827055941.GL7538@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190827055941.GL7538@dhcp22.suse.cz> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 27, 2019 at 07:59:41AM +0200, Michal Hocko wrote: > > > > > IIUC deferred splitting is mostly a workaround for nasty locking issues > > > > > during splitting, right? This is not really an optimization to cache > > > > > THPs for reuse or something like that. What is the reason this is not > > > > > done from a worker context? At least THPs which would be freed > > > > > completely sound like a good candidate for kworker tear down, no? > > > > Yes, deferred split THP was introduced to avoid locking issues according to > > > > the document. Memcg awareness would help to trigger the shrinker more often. > > > > > > > > I think it could be done in a worker context, but when to trigger to worker > > > > is a subtle problem. > > > Why? What is the problem to trigger it after unmap of a batch worth of > > > THPs? > > > > This leads to another question, how many THPs are "a batch of worth"? > > Some arbitrary reasonable number. Few dozens of THPs waiting for split > are no big deal. Going into GB as you pointed out above is definitely a > problem. This will not work if these GBs worth of THPs are pinned (like with RDMA). We can kick the deferred split each N calls of deferred_split_huge_page() if more than M pages queued or something. Do we want to kick it again after some time if split from deferred queue has failed? The check if the page is splittable is not exactly free, so everyting has trade offs. -- Kirill A. Shutemov