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=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,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 7B874C33CB3 for ; Sat, 18 Jan 2020 00:58:02 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2244A246A3 for ; Sat, 18 Jan 2020 00:58:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2244A246A3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 708B46B0514; Fri, 17 Jan 2020 19:58:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6B9AA6B0515; Fri, 17 Jan 2020 19:58:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5D08B6B0516; Fri, 17 Jan 2020 19:58:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0009.hostedemail.com [216.40.44.9]) by kanga.kvack.org (Postfix) with ESMTP id 474C96B0514 for ; Fri, 17 Jan 2020 19:58:01 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id EB9B6180AD807 for ; Sat, 18 Jan 2020 00:58:00 +0000 (UTC) X-FDA: 76388943120.30.curve24_ba44e4006f38 X-HE-Tag: curve24_ba44e4006f38 X-Filterd-Recvd-Size: 4356 Received: from out30-44.freemail.mail.aliyun.com (out30-44.freemail.mail.aliyun.com [115.124.30.44]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Sat, 18 Jan 2020 00:57:59 +0000 (UTC) X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R171e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01f04397;MF=yang.shi@linux.alibaba.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---0To-chkr_1579309064; Received: from US-143344MP.local(mailfrom:yang.shi@linux.alibaba.com fp:SMTPD_---0To-chkr_1579309064) by smtp.aliyun-inc.com(127.0.0.1); Sat, 18 Jan 2020 08:57:54 +0800 Subject: Re: [Patch v4] mm: thp: remove the defer list related code since this will not happen To: Wei Yang , hannes@cmpxchg.org, mhocko@kernel.org, vdavydov.dev@gmail.com, akpm@linux-foundation.org, ktkhai@virtuozzo.com, kirill.shutemov@linux.intel.com Cc: cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, alexander.duyck@gmail.com, rientjes@google.com, stable@vger.kernel.org References: <20200117233836.3434-1-richardw.yang@linux.intel.com> From: Yang Shi Message-ID: Date: Fri, 17 Jan 2020 16:57:41 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20200117233836.3434-1-richardw.yang@linux.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US 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 1/17/20 3:38 PM, 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+] > > --- > v4: > * finally we identified the related code is not necessary and not > correct, just remove it > * thanks to Kirill T first spot some problem Thanks for debugging and figuring this out. Acked-by: Yang Shi > v3: > * remove all review/ack tag since rewrite the changelog > * use deferred_split_huge_page as the example of race > * add cc stable 5.4+ tag as suggested by David Rientjes > > v2: > * move check on compound outside suggested by Alexander > * an example of the race condition, suggested by Michal > --- > mm/memcontrol.c | 18 ------------------ > 1 file changed, 18 deletions(-) > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index 6c83cf4ed970..27c231bf4565 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -5340,14 +5340,6 @@ static int mem_cgroup_move_account(struct page *page, > __mod_lruvec_state(to_vec, NR_WRITEBACK, nr_pages); > } > > -#ifdef CONFIG_TRANSPARENT_HUGEPAGE > - if (compound && !list_empty(page_deferred_list(page))) { > - spin_lock(&from->deferred_split_queue.split_queue_lock); > - list_del_init(page_deferred_list(page)); > - from->deferred_split_queue.split_queue_len--; > - spin_unlock(&from->deferred_split_queue.split_queue_lock); > - } > -#endif > /* > * It is safe to change page->mem_cgroup here because the page > * is referenced, charged, and isolated - we can't race with > @@ -5357,16 +5349,6 @@ static int mem_cgroup_move_account(struct page *page, > /* caller should have done css_get */ > page->mem_cgroup = to; > > -#ifdef CONFIG_TRANSPARENT_HUGEPAGE > - if (compound && list_empty(page_deferred_list(page))) { > - spin_lock(&to->deferred_split_queue.split_queue_lock); > - list_add_tail(page_deferred_list(page), > - &to->deferred_split_queue.split_queue); > - to->deferred_split_queue.split_queue_len++; > - spin_unlock(&to->deferred_split_queue.split_queue_lock); > - } > -#endif > - > spin_unlock_irqrestore(&from->move_lock, flags); > > ret = 0;