Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5461361ybl; Tue, 27 Aug 2019 05:10:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqx7FT47iSuOo/NpwarTMa3ZgbSlHSKGQd8i+9xPy+SMlNe6+DKaAbIsx/8Qr69GgVKsfXed X-Received: by 2002:a17:902:f204:: with SMTP id gn4mr14851524plb.23.1566907841409; Tue, 27 Aug 2019 05:10:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566907841; cv=none; d=google.com; s=arc-20160816; b=XLBTE8t0Jm43S+l/MTriy7ZhecXndFU8d8LPVBm+UTRrp/R949WT649+gtnrWIzvei MfCU67X//sBTrvMkgzj8pkffZ9cpZ9IYJ2nZDH6HyTQSeHtlCKNWa8dOLgBIgpTSKnHQ 4wIenfz9OERoZ6ty6cgTBImtT8ccZhPRSFe0FIg8Qi8NYpmkqFnIwHTR7jnTjkH23LMD klIvIAFJ2Us280MMuKNbZxNMGiyagNdvJv2qbAY7hMYeKLHxLy2KQ3C4bHfE81TyH4bI zP75X20ntRGVie5mV+MJsTFy/sF6J0Kku1m1mpd1yVOQi0ig7KdD/9zX5JUdgYQEdjol 9w/Q== 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=JKsWx1PrIckIBJcX2siyF7hxbi89lylt1Z8SDAwDetU=; b=B2eqhRh/Y4ekGkYIPUSb1eOt7sGwhgb5YEe/2vnoqdgO6Waiq/leSTM0csqQzHXjme SrnjB4sVs0AIIqLzNqPhNlvuRbFlHr32RfMtY3A6lEzGcfLHbxhT7z4hYK9mtlW2DNDr TZy630O3ER+vDN9IoEkKihFP1xhe0C9JGESoZNYTwNafSYt0ENOJuzS+DLuPBOti4ptF XGua0hevALsbXeUJjessuWb26fof9UsFiDaAkTqyroFKjV7RncDANTwOazdNTTr28PRO ur0ZnVuKoVy+jio7819H7nbZEtq/3q1aCwEkt3yB0cXoy5fhDc4lqM8PgpUl07oWFgoX 9G5g== 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 g11si13618379plm.230.2019.08.27.05.10.23; Tue, 27 Aug 2019 05:10: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 S1727138AbfH0MJ0 (ORCPT + 99 others); Tue, 27 Aug 2019 08:09:26 -0400 Received: from mx2.suse.de ([195.135.220.15]:47836 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725850AbfH0MJ0 (ORCPT ); Tue, 27 Aug 2019 08:09:26 -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 284E9AF19; Tue, 27 Aug 2019 12:09:25 +0000 (UTC) Date: Tue, 27 Aug 2019 14:09:23 +0200 From: Michal Hocko To: Vlastimil Babka Cc: "Kirill A. Shutemov" , kirill.shutemov@linux.intel.com, Yang Shi , hannes@cmpxchg.org, 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: <20190827120923.GB7538@dhcp22.suse.cz> References: <1566410125-66011-1-git-send-email-yang.shi@linux.alibaba.com> <20190822080434.GF12785@dhcp22.suse.cz> <20190822152934.w6ztolutdix6kbvc@box> <20190826074035.GD7538@dhcp22.suse.cz> <20190826131538.64twqx3yexmhp6nf@box> <20190827060139.GM7538@dhcp22.suse.cz> <20190827110210.lpe36umisqvvesoa@box> 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 Tue 27-08-19 14:01:56, Vlastimil Babka wrote: > On 8/27/19 1:02 PM, Kirill A. Shutemov wrote: > > On Tue, Aug 27, 2019 at 08:01:39AM +0200, Michal Hocko wrote: > >> On Mon 26-08-19 16:15:38, Kirill A. Shutemov wrote: > >>> > >>> Unmapped completely pages will be freed with current code. Deferred split > >>> only applies to partly mapped THPs: at least on 4k of the THP is still > >>> mapped somewhere. > >> > >> Hmm, I am probably misreading the code but at least current Linus' tree > >> reads page_remove_rmap -> [page_remove_anon_compound_rmap ->\ deferred_split_huge_page even > >> for fully mapped THP. > > > > Well, you read correctly, but it was not intended. I screwed it up at some > > point. > > > > See the patch below. It should make it work as intened. > > > > It's not bug as such, but inefficientcy. We add page to the queue where > > it's not needed. > > But that adding to queue doesn't affect whether the page will be freed > immediately if there are no more partial mappings, right? I don't see > deferred_split_huge_page() pinning the page. > So your patch wouldn't make THPs freed immediately in cases where they > haven't been freed before immediately, it just fixes a minor > inefficiency with queue manipulation? Ohh, right. I can see that in free_transhuge_page now. So fully mapped THPs really do not matter and what I have considered an odd case is really happening more often. That being said this will not help at all for what Yang Shi is seeing and we need a more proactive deferred splitting as I've mentioned earlier. -- Michal Hocko SUSE Labs