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=ham 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 01032C33CB7 for ; Sat, 18 Jan 2020 05:31:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BF4A72073A for ; Sat, 18 Jan 2020 05:31:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BF4A72073A 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 48CDF6B051E; Sat, 18 Jan 2020 00:31:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 43CA66B051F; Sat, 18 Jan 2020 00:31:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 32C3A6B0520; Sat, 18 Jan 2020 00:31:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0043.hostedemail.com [216.40.44.43]) by kanga.kvack.org (Postfix) with ESMTP id 1BB1C6B051E for ; Sat, 18 Jan 2020 00:31:09 -0500 (EST) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id B0E01181AEF1A for ; Sat, 18 Jan 2020 05:31:08 +0000 (UTC) X-FDA: 76389631416.11.sky56_4414169151158 X-HE-Tag: sky56_4414169151158 X-Filterd-Recvd-Size: 4952 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Sat, 18 Jan 2020 05:31:07 +0000 (UTC) X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R131e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04407;MF=yang.shi@linux.alibaba.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---0To.f-S7_1579325449; Received: from US-143344MP.local(mailfrom:yang.shi@linux.alibaba.com fp:SMTPD_---0To.f-S7_1579325449) by smtp.aliyun-inc.com(127.0.0.1); Sat, 18 Jan 2020 13:31:00 +0800 Subject: Re: [Patch v4] mm: thp: remove the defer list related code since this will not happen From: Yang Shi 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> Message-ID: <25e1226a-9cce-6a75-f0e9-b42f5afa22da@linux.alibaba.com> Date: Fri, 17 Jan 2020 21:30:45 -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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable 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 4:57 PM, Yang Shi wrote: > > > 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=20 >> aware") >> >> Signed-off-by: Wei Yang >> Suggested-by: Kirill A. Shutemov >> Cc: =C2=A0=C2=A0=C2=A0 [5.4+] >> >> --- >> v4: >> =C2=A0=C2=A0 * finally we identified the related code is not necessary= and not >> =C2=A0=C2=A0=C2=A0=C2=A0 correct, just remove it >> =C2=A0=C2=A0 * thanks to Kirill T first spot some problem > > Thanks for debugging and figuring this out. Acked-by: Yang Shi=20 > BTW, the patch itself is fine, but the subject looks really confusing.=20 It sounds like we would remove all deferred list code. I'd suggest=20 rephrase it to: mm: thp: don't need care deferred split queue in memcg charge move path > >> v3: >> =C2=A0=C2=A0 * remove all review/ack tag since rewrite the changelog >> =C2=A0=C2=A0 * use deferred_split_huge_page as the example of race >> =C2=A0=C2=A0 * add cc stable 5.4+ tag as suggested by David Rientjes >> >> v2: >> =C2=A0=C2=A0 * move check on compound outside suggested by Alexander >> =C2=A0=C2=A0 * an example of the race condition, suggested by Michal >> --- >> =C2=A0 mm/memcontrol.c | 18 ------------------ >> =C2=A0 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=20 >> *page, >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 __mod_lruvec_st= ate(to_vec, NR_WRITEBACK, nr_pages); >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } >> =C2=A0 -#ifdef CONFIG_TRANSPARENT_HUGEPAGE >> -=C2=A0=C2=A0=C2=A0 if (compound && !list_empty(page_deferred_list(pag= e))) { >> - spin_lock(&from->deferred_split_queue.split_queue_lock); >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 list_del_init(page_deferre= d_list(page)); >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 from->deferred_split_queue= .split_queue_len--; >> - spin_unlock(&from->deferred_split_queue.split_queue_lock); >> -=C2=A0=C2=A0=C2=A0 } >> -#endif >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * It is safe to change page->mem_= cgroup here because the page >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * is referenced, charged, and iso= lated - we can't race with >> @@ -5357,16 +5349,6 @@ static int mem_cgroup_move_account(struct page=20 >> *page, >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* caller should have done css_get */ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 page->mem_cgroup =3D to; >> =C2=A0 -#ifdef CONFIG_TRANSPARENT_HUGEPAGE >> -=C2=A0=C2=A0=C2=A0 if (compound && list_empty(page_deferred_list(page= ))) { >> - spin_lock(&to->deferred_split_queue.split_queue_lock); >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 list_add_tail(page_deferre= d_list(page), >> - &to->deferred_split_queue.split_queue); >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 to->deferred_split_queue.s= plit_queue_len++; >> - spin_unlock(&to->deferred_split_queue.split_queue_lock); >> -=C2=A0=C2=A0=C2=A0 } >> -#endif >> - >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 spin_unlock_irqrestore(&from->move_lock= , flags); >> =C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ret =3D 0; >