Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2123251pxa; Mon, 24 Aug 2020 06:00:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3r4UTJRMw1r0ltjimTmQMnWeOJH2dLFP6hnvdTcsvbzEl5Ek59z9Ch8clls7eyGRgz2FU X-Received: by 2002:a17:906:f143:: with SMTP id gw3mr5739447ejb.125.1598274058773; Mon, 24 Aug 2020 06:00:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598274058; cv=none; d=google.com; s=arc-20160816; b=YbEWVJ4L7dSv8eZWqsRLPfBqDnDnB22QD+Zg0LDdmFUukDS6ei/5f/HT1lOdtQlqmN 1dSKYrUiWHJqfbDZgxXi486NTsI9nWPf74quQiZoXib41OVBlBNcrScJZYswHQWaF0gV LDhWO/nztm2Zyr/2MhSa5NnWtDSEnY//vE2Za8THCTJt1DZuQpZIOft+UZRMMziPq9Ri mA2VVySnUbvRYrYdfeyKYzH2HzVFGZiL+TQKtDqLRRCQrYSJSnU2TDjSdXNq3yGRSibZ 6fl9gtNEzdtNOrtM2ax9zl2ULXj4FWxg6Plvbo6OD5xA9+vA2FLFFH7+vwsKFrwnap7b d5xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:to:from; bh=onVo1RzidhFdK9bpBpTgu8vjdtNq5YUEtfSiisDSzxE=; b=kZhaxjxF32+SBQlJzAEtW/ZWEBzZdITNp77P/4/0zGm00ZDkV8icb5ddKrHmGcUDIP OKWEvDTgfk79PFabHFdKxdHFqxyZ7enb0lI1gXayz8LsQk4/a3Q92PvADlvDU7/Vewg3 ZNQmAzaLR1yxy71D3s4s9FjQU71YRUTVp5MzN/KZ8SJrT8UimYmLkndwlB28hMBoYgRI DS67oEAiCp8Z+WGFzXUEaV79zFC0J/uoHCnn39moIlWV+5skRfoo34e9RieOkqFD3o3x MJyxN24KMKsNOzB6YLH6oV8NKC/+6dpDcpNN/sfPLOi8YdA4AxXXAhJirEjVK5c/0qxZ pbNg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g21si1449520ejc.79.2020.08.24.06.00.35; Mon, 24 Aug 2020 06:00:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727885AbgHXM5d (ORCPT + 99 others); Mon, 24 Aug 2020 08:57:33 -0400 Received: from out4436.biz.mail.alibaba.com ([47.88.44.36]:11488 "EHLO out4436.biz.mail.alibaba.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727824AbgHXMz2 (ORCPT ); Mon, 24 Aug 2020 08:55:28 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01f04427;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=21;SR=0;TI=SMTPD_---0U6k9-bl_1598273712; Received: from aliy80.localdomain(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0U6k9-bl_1598273712) by smtp.aliyun-inc.com(127.0.0.1); Mon, 24 Aug 2020 20:55:14 +0800 From: Alex Shi To: akpm@linux-foundation.org, mgorman@techsingularity.net, tj@kernel.org, hughd@google.com, khlebnikov@yandex-team.ru, daniel.m.jordan@oracle.com, willy@infradead.org, hannes@cmpxchg.org, lkp@intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, shakeelb@google.com, iamjoonsoo.kim@lge.com, richard.weiyang@gmail.com, kirill@shutemov.name, alexander.duyck@gmail.com, rong.a.chen@intel.com, mhocko@suse.com, vdavydov.dev@gmail.com, shy828301@gmail.com Subject: [PATCH v18 05/32] mm/thp: remove code path which never got into Date: Mon, 24 Aug 2020 20:54:38 +0800 Message-Id: <1598273705-69124-6-git-send-email-alex.shi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1598273705-69124-1-git-send-email-alex.shi@linux.alibaba.com> References: <1598273705-69124-1-git-send-email-alex.shi@linux.alibaba.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org split_huge_page() will never call on a page which isn't on lru list, so this code never got a chance to run, and should not be run, to add tail pages on a lru list which head page isn't there. Although the bug was never triggered, it'better be removed for code correctness, and add a warn for unexpected calling. Signed-off-by: Alex Shi Reviewed-by: Kirill A. Shutemov Cc: Kirill A. Shutemov Cc: Andrew Morton Cc: Johannes Weiner Cc: Matthew Wilcox Cc: Hugh Dickins Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org --- mm/huge_memory.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 739497770a3d..247f53def87b 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2330,17 +2330,8 @@ static void lru_add_page_tail(struct page *head, struct page *page_tail, /* page reclaim is reclaiming a huge page */ get_page(page_tail); list_add_tail(&page_tail->lru, list); - } else { - /* - * Head page has not yet been counted, as an hpage, - * so we must account for each subpage individually. - * - * Put page_tail on the list at the correct position - * so they all end up in order. - */ - add_page_to_lru_list_tail(page_tail, lruvec, - page_lru(page_tail)); - } + } else + VM_WARN_ON(!PageLRU(head)); } static void __split_huge_page_tail(struct page *head, int tail, -- 1.8.3.1