Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2317914ybl; Mon, 20 Jan 2020 00:18:07 -0800 (PST) X-Google-Smtp-Source: APXvYqy32Wl1nVbulg6CK6pjiNHh41UoPdJwFMfgjGYy0BrgB1rvBry2KbvBw0T1MZzlBDcXKgLp X-Received: by 2002:a05:6830:10a:: with SMTP id i10mr14580465otp.365.1579508286876; Mon, 20 Jan 2020 00:18:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579508286; cv=none; d=google.com; s=arc-20160816; b=mgnkw+ItNBx0+8hCtXawT+7JSuOh5uEoMzpfy1th0MLA5a0K7jAAOXKVSIM7pDAlWX uFkOCvhRsMot/Lv5Ez8EHDd4Hz1Ha+2Dk0rncpxavN/znfqzb1Btnofqgfj8KJgpoiR/ h9nGFNjFsy2WLU3ixFanLML/mMXO2xXdHIwBdRCod/V7MyecGLvwUVaYxiUgfPE0HKqV S47KEpHOH5QDfswcUXSHRzHILvTgwZuLA2JLJf9mOUkIFMHwFo6jXH2JRqrhdsYMEyWJ sJBhv7KMg0+rTTVznohjtl1YYCMnSgI8XVY1rlEtzSiwzSEd76OJigRakEAmMdcLQ4rI 8prQ== 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:reply-to:message-id :subject:cc:to:from:date; bh=Q9giLS8mMt+Ds3i3Tgwt0gcML1qCpMIKzEb4A/NqM+c=; b=cBNFLpl31Ny33V7frb15/70kER7NFF2Tmb2I2wsH7TvfI6OTWzK1GJLHdVEicW67D/ GBV3n35pQnG5zJltSEuLdRpyR0ZS62Hnq/syTdrfGSLgGG26o/F9/7fF5RqITM0RzsAR GqkpmDMWUxU+314yXvMzerGtv/b9HiCNQ/rWlA3vLYjPV/G3/bnYJP600E82xwTbzvk6 bLhTHQseolvvosg5qRcfFy+G6PKPb9NYIMOqzKRsFSfG79AlvYsSbFx7IkBN7dr8RsHd J+FmB09UjOatN14+FLdN5Fe/RNG42vHrddSuLhw9G90l+gj3mNEFl783+z7NIA+9bNvk ezbw== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l7si20630228oth.11.2020.01.20.00.17.54; Mon, 20 Jan 2020 00:18:06 -0800 (PST) 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726650AbgATIRD (ORCPT + 99 others); Mon, 20 Jan 2020 03:17:03 -0500 Received: from mga01.intel.com ([192.55.52.88]:38466 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726039AbgATIRC (ORCPT ); Mon, 20 Jan 2020 03:17:02 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jan 2020 00:17:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,341,1574150400"; d="scan'208";a="258624482" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga002.fm.intel.com with ESMTP; 20 Jan 2020 00:17:00 -0800 Date: Mon, 20 Jan 2020 16:17:10 +0800 From: Wei Yang To: Michal Hocko Cc: David Rientjes , Andrew Morton , Wei Yang , hannes@cmpxchg.org, vdavydov.dev@gmail.com, ktkhai@virtuozzo.com, kirill.shutemov@linux.intel.com, yang.shi@linux.alibaba.com, cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, alexander.duyck@gmail.com, stable@vger.kernel.org Subject: Re: [Patch v4] mm: thp: remove the defer list related code since this will not happen Message-ID: <20200120081710.GA18028@richard> Reply-To: Wei Yang References: <20200117233836.3434-1-richardw.yang@linux.intel.com> <20200118145421.0ab96d5d9bea21a3339d52fe@linux-foundation.org> <20200120072237.GA18451@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200120072237.GA18451@dhcp22.suse.cz> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 20, 2020 at 08:22:37AM +0100, Michal Hocko wrote: >On Sat 18-01-20 15:36:06, David Rientjes wrote: >> On Sat, 18 Jan 2020, Andrew Morton wrote: >> >> > On Sat, 18 Jan 2020 07:38:36 +0800 Wei Yang wrote: >> > >> > > If compound is true, this means it is a PMD mapped THP. Which implies >> > > the page is not linked to any defer list. So the first code chunk will >> > > not be executed. >> > > >> > > Also with this reason, it would not be proper to add this page to a >> > > defer list. So the second code chunk is not correct. >> > > >> > > Based on this, we should remove the defer list related code. >> > > >> > > Fixes: 87eaceb3faa5 ("mm: thp: make deferred split shrinker memcg aware") >> > > >> > > Signed-off-by: Wei Yang >> > > Suggested-by: Kirill A. Shutemov >> > > Cc: [5.4+] >> > >> > This patch is identical to "mm: thp: grab the lock before manipulating >> > defer list", which is rather confusing. Please let people know when >> > this sort of thing is done. >> > >> > The earlier changelog mentioned a possible race condition. This >> > changelog does not. In fact this changelog fails to provide any >> > description of any userspace-visible runtime effects of the bug. >> > Please send along such a description for inclusion, as always. >> > >> >> The locking concern that Wei was originally looking at is no longer an >> issue because we determined that the code in question could simply be >> removed. >> >> I think the following can be added to the changelog: >> >> ----->o----- >> >> When migrating memcg charges of thp memory, there are two possibilities: >> >> (1) The underlying compound page is mapped by a pmd and thus does is not >> on a deferred split queue (it's mapped), or >> >> (2) The compound page is not mapped by a pmd and is awaiting split on a >> deferred split queue. >> >> The current charge migration implementation does *not* migrate charges for >> thp memory on the deferred split queue, it only migrates charges for pages >> that are mapped by a pmd. >> >> Thus, to migrate charges, the underlying compound page cannot be on a >> deferred split queue; no list manipulation needs to be done in >> mem_cgroup_move_account(). >> >> With the current code, the underlying compound page is moved to the >> deferred split queue of the memcg its memory is not charged to, so >> susbequent reclaim will consider these pages for the wrong memcg. Remove >> the deferred split queue handling in mem_cgroup_move_account() entirely. > >I believe this still doesn't describe the underlying problem to the full >extent. What happens with the page on the deferred list when it >shouldn't be there in fact? Unless I am missing something deferred_split_scan >will simply split that huge page. Which is a bit unfortunate but nothing >really critical. This should be mentioned in the changelog. > Per my understanding, if we do the split when it is not necessary, we probably have a lower performance due to tlb miss. For others, I don't see the impact. >With that clarified, feel free to add > >Acked-by: Michal Hocko > >-- >Michal Hocko >SUSE Labs -- Wei Yang Help you, Help me