Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2927437ybh; Sat, 25 Jul 2020 06:01:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxuhQ0qK2DSlzWeP3HCYXQ+dMzMfdCI5u/jKrgKhQpY0O0zNmOh8MVphImMaR6wSmqSjFsF X-Received: by 2002:a17:906:5f98:: with SMTP id a24mr9371927eju.241.1595682074850; Sat, 25 Jul 2020 06:01:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595682074; cv=none; d=google.com; s=arc-20160816; b=KXVagiaWJ9XlnUREk3/UztMeCWP03v74aQc8bUiMnCqBe5MiAIuJ2PgtuXYNxgvOyB 2mQgUNdGntYU2FnJBqQcOZq/NVINAaTzdWw33fuJQ4TuBOMwxsBpIHeojN9HzSOVADXY a2xzDj+w23mbkQ0u6/mpotpSuSQTa0FHFww8nvpMqq+LeY/Nki2YzuWqx7Ygd1WoIav+ V0mo8A/4xx8i4RtEoxA5gBJ6ejLVWXGrX4KlxlFdwcEOlNpdZmVK3t6PiYwbPIiFDC8c 9NAJJmAvmXol9Cuyu3BKlt5yBuX4Xb0ydijgANgVEZVigFb7BCKoHXwUG3q6JT9fT/pK grQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=6gcO5icxI0//eFwwtvV3l6OQ/tESyxsUT1D9zvjLRqg=; b=jqIm6WLyYGnmibGoPGCMeXbG2ZvEP3Ak4cgK6aOnd8jSEjKVeDvJpRIUoIPBtiSv+E CtWdR9GeEp3ISun5RLNxnaWycOTx5vYHSRMlNP6fsBf/vl2SZ+hzLFUDtIMgdoLz0Sck ECXX0nAd05paaDHtDpw+tT/6HTYqUQ7ipRPGhrK57dvkgUEgA8Qgd+zVPC+JxpLbzrN8 TzlD8hqOMuygGJq3BVLySY63TF3W3OD2xAQXybdgRcRNx5oMv2h82d927pdJ1MGDy/ht YnK236keLYoOt2L8Qv0UgBAbWU9MZYpbijQbKKtHoGpmisaPiBw+vmsDYZsoynY3jBy5 EbiA== 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 pg3si2624656ejb.284.2020.07.25.06.00.52; Sat, 25 Jul 2020 06:01:14 -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 S1727818AbgGYNAg (ORCPT + 99 others); Sat, 25 Jul 2020 09:00:36 -0400 Received: from out30-54.freemail.mail.aliyun.com ([115.124.30.54]:40063 "EHLO out30-54.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726613AbgGYNAe (ORCPT ); Sat, 25 Jul 2020 09:00:34 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R551e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07425;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=20;SR=0;TI=SMTPD_---0U3l6fmD_1595682015; Received: from aliy8.localdomain(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0U3l6fmD_1595682015) by smtp.aliyun-inc.com(127.0.0.1); Sat, 25 Jul 2020 21:00:27 +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, yang.shi@linux.alibaba.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 Cc: =?UTF-8?q?Mika=20Penttil=C3=A4?= Subject: [PATCH v17 15/21] mm/thp: add tail pages into lru anyway in split_huge_page() Date: Sat, 25 Jul 2020 20:59:52 +0800 Message-Id: <1595681998-19193-16-git-send-email-alex.shi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1595681998-19193-1-git-send-email-alex.shi@linux.alibaba.com> References: <1595681998-19193-1-git-send-email-alex.shi@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Split_huge_page() must start with PageLRU(head), and we are holding the lru_lock here. If the head was cleared lru bit unexpected, tracking it. 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: Mika Penttilä Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org --- mm/huge_memory.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index d866b6e43434..28538444197b 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2348,15 +2348,19 @@ static void lru_add_page_tail(struct page *head, struct page *page_tail, VM_BUG_ON_PAGE(PageLRU(page_tail), head); lockdep_assert_held(&lruvec_pgdat(lruvec)->lru_lock); - if (!list) - SetPageLRU(page_tail); - - if (likely(PageLRU(head))) - list_add_tail(&page_tail->lru, &head->lru); - else if (list) { + if (list) { /* page reclaim is reclaiming a huge page */ get_page(page_tail); list_add_tail(&page_tail->lru, list); + } else { + /* + * Split start from PageLRU(head), and we are holding the + * lru_lock. + * Do a warning if the head's lru bit was cleared unexpected. + */ + VM_WARN_ON(!PageLRU(head)); + SetPageLRU(page_tail); + list_add_tail(&page_tail->lru, &head->lru); } } -- 1.8.3.1