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.5 required=3.0 tests=MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 C8231C3F68F for ; Mon, 20 Jan 2020 07:22:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7CD2320684 for ; Mon, 20 Jan 2020 07:22:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7CD2320684 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DA4FC6B05B0; Mon, 20 Jan 2020 02:22:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D54EE6B05B1; Mon, 20 Jan 2020 02:22:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C6BB56B05B2; Mon, 20 Jan 2020 02:22:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0203.hostedemail.com [216.40.44.203]) by kanga.kvack.org (Postfix) with ESMTP id AF54B6B05B0 for ; Mon, 20 Jan 2020 02:22:40 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 5DF2237F1 for ; Mon, 20 Jan 2020 07:22:40 +0000 (UTC) X-FDA: 76397170080.09.lead25_8bae0a667bd63 X-HE-Tag: lead25_8bae0a667bd63 X-Filterd-Recvd-Size: 5786 Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Mon, 20 Jan 2020 07:22:39 +0000 (UTC) Received: by mail-wr1-f65.google.com with SMTP id y17so28339907wrh.5 for ; Sun, 19 Jan 2020 23:22:39 -0800 (PST) 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=hTCsEqhnbed2yOohKKa5cDEabb8n+zDv0sqNRlWlasA=; b=hIzqXDcrny2A7ZwDVGfyQEoe+Gtzo4T+1qdWWlJz+FW1B2GZjEpiXQq2U7G7h81VMU B9/GfCiv8e1uAA2UIHWCBI5RRwHnvskh67NRETbFDfY/8hdVOXgQcO7xv7mLcO0+xQxn aviQkTjXeph9l1UAvwiOYZm/JuDbOXjtkl1IHLDfEm2QJhM8XSuPhfHxsowfRpWBDetG 0HK95DQj3Oh+3LTscF7PkSDI6ckqK/niPvOmI5xXCYjTugKK2gEsNe3QMbvBY3IaREiV qmtwreMfmzQHysw6AjBIimqUAYpAUqXEz4ebS1p62W5I0jh6YNCJwRsq9gQWAobt9USL qk+Q== X-Gm-Message-State: APjAAAWytqYXiL69s2HOZJ7DgSzahbmA6NFKmeqL6BzxZLv75fbLo8C+ c1g7A8fZS4yF2qG67KgR8xo= X-Google-Smtp-Source: APXvYqz2iKEyfHH4o8n7UwHlrXbuZHD2r/KRCLb4H54aiHlWXHfI2T42/+/ZrJKyKqvFz7N2h/rY6Q== X-Received: by 2002:adf:e3c7:: with SMTP id k7mr16533068wrm.80.1579504958617; Sun, 19 Jan 2020 23:22:38 -0800 (PST) Received: from localhost (ip-37-188-138-155.eurotel.cz. [37.188.138.155]) by smtp.gmail.com with ESMTPSA id w83sm21395092wmb.42.2020.01.19.23.22.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jan 2020 23:22:37 -0800 (PST) Date: Mon, 20 Jan 2020 08:22:37 +0100 From: Michal Hocko To: David Rientjes Cc: 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: <20200120072237.GA18451@dhcp22.suse.cz> References: <20200117233836.3434-1-richardw.yang@linux.intel.com> <20200118145421.0ab96d5d9bea21a3339d52fe@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) 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 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. With that clarified, feel free to add Acked-by: Michal Hocko -- Michal Hocko SUSE Labs