Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp175313ybl; Thu, 9 Jan 2020 19:28:57 -0800 (PST) X-Google-Smtp-Source: APXvYqyj+fSl6wjEXzctOzGuhPhSP1/HwBJPVjMQhNthrR93ulRNP7QQyLFQyEBQWdtOZeFTriOI X-Received: by 2002:aca:5487:: with SMTP id i129mr546125oib.167.1578626937093; Thu, 09 Jan 2020 19:28:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578626937; cv=none; d=google.com; s=arc-20160816; b=uPq++aaAHiqwg8j9EmpiW5ocdje//0PhPICGsuyc136Xx0sQLCRtUsWYj2Vdu2fqwD h30dXiLyYNFrusm1kRFmonJ0RJ0zRQHbqTq8MjAM4I+4bVBrk76ZygrHDKeXgszO0rSQ lN7gSdGBC5sYHC5ZYOn0Lgnsa6xpvzdkyI1YUkNVuoYTVzrnrnN4/x1AL1lDoniM/mpJ CaA0qa+Tf1OyWfI//hFnVcSkQpu4XMPiKV3DXzMZkPJN8q4C/Ixu7uEufaG3LUMxHde9 zgoRVVGEH2sIaX+BfvCscgY9epO7NTYprocTIjYDHNyRVf9nj9wlOH0i1pSA7wdMn3Tj e1WQ== 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:cc:to:from; bh=DZDfYAVQB8yH2qQwgm70U0eGh6+XDQ+V8zZeOMeFTTs=; b=MntawE+4d0sZKH2ZuO6gT8RjSHhrpABdal3vH/n3JNrQYmOFTfdrQBeFPzhTpHp881 jI+mM1tT3hrksDsQqvas7N4KN01O+0TrcwUYXwdoqQ6MNwqI+dC7WlGvyRkYtoNTRnkp SQbZG3p1Nxquyfrdb8XCV4LfGlPYKKq1IC7fZo7H+xztbeKXtoOPBZsyXCVj1t0swV20 LWL9qah7CZQ2pVSnp0WQa1yk01ZWRFWxVeiz3Gbr+BQTs3lL+nBXwV9o8w1fz36vJ7/p 7ktv2yFUB8YJJNSVGsSYNIgxHn7eZzN/C/SuJ1OsaTYEVFrium3k3YiizLHLXCp7jQrd J3pw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a64si345533oif.256.2020.01.09.19.28.45; Thu, 09 Jan 2020 19:28:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731056AbgAJD01 (ORCPT + 99 others); Thu, 9 Jan 2020 22:26:27 -0500 Received: from mga03.intel.com ([134.134.136.65]:7944 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730965AbgAJD00 (ORCPT ); Thu, 9 Jan 2020 22:26:26 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Jan 2020 19:26:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,415,1571727600"; d="scan'208";a="216520441" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by orsmga008.jf.intel.com with ESMTP; 09 Jan 2020 19:26:24 -0800 From: Wei Yang To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, kirill.shutemov@linux.intel.com, Wei Yang Subject: [PATCH 2/2] mm/huge_memory.c: use head to emphasize the purpose of page Date: Fri, 10 Jan 2020 11:26:10 +0800 Message-Id: <20200110032610.26499-2-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200110032610.26499-1-richardw.yang@linux.intel.com> References: <20200110032610.26499-1-richardw.yang@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org During split huge page, it checks the property of the page. Currently we do the check on page and head without emphasizing the check is on the compound page. In case the page passed to split_huge_page_to_list is a tail page, audience would take some time to think about whether the check is on compound page or tail page itself. To make it explicit, use head instead of page for those checks. After this, audience would be more clear about the checks are on compound page and the page is used to do the split and dump error message if failed. Signed-off-by: Wei Yang --- mm/huge_memory.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 90165f68cf13..69e623216211 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2688,7 +2688,7 @@ int split_huge_page_to_list(struct page *page, struct list_head *list) { struct page *head = compound_head(page); struct pglist_data *pgdata = NODE_DATA(page_to_nid(head)); - struct deferred_split *ds_queue = get_deferred_split_queue(page); + struct deferred_split *ds_queue = get_deferred_split_queue(head); struct anon_vma *anon_vma = NULL; struct address_space *mapping = NULL; int count, mapcount, extra_pins, ret; @@ -2697,10 +2697,10 @@ int split_huge_page_to_list(struct page *page, struct list_head *list) pgoff_t end; VM_BUG_ON_PAGE(is_huge_zero_page(head), head); - VM_BUG_ON_PAGE(!PageLocked(page), page); - VM_BUG_ON_PAGE(!PageCompound(page), page); + VM_BUG_ON_PAGE(!PageLocked(head), head); + VM_BUG_ON_PAGE(!PageCompound(head), head); - if (PageWriteback(page)) + if (PageWriteback(head)) return -EBUSY; if (PageAnon(head)) { @@ -2751,7 +2751,7 @@ int split_huge_page_to_list(struct page *page, struct list_head *list) goto out_unlock; } - mlocked = PageMlocked(page); + mlocked = PageMlocked(head); unmap_page(head); VM_BUG_ON_PAGE(compound_mapcount(head), head); @@ -2785,10 +2785,10 @@ int split_huge_page_to_list(struct page *page, struct list_head *list) } spin_unlock(&ds_queue->split_queue_lock); if (mapping) { - if (PageSwapBacked(page)) - __dec_node_page_state(page, NR_SHMEM_THPS); + if (PageSwapBacked(head)) + __dec_node_page_state(head, NR_SHMEM_THPS); else - __dec_node_page_state(page, NR_FILE_THPS); + __dec_node_page_state(head, NR_FILE_THPS); } __split_huge_page(page, list, end, flags); -- 2.17.1