From patchwork Wed Apr 4 19:18:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jerome Glisse X-Patchwork-Id: 10323105 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0903560390 for ; Wed, 4 Apr 2018 19:21:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EFE6028F6C for ; Wed, 4 Apr 2018 19:21:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2B6C28F9E; Wed, 4 Apr 2018 19:21:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F63728F6C for ; Wed, 4 Apr 2018 19:21:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752506AbeDDTUj (ORCPT ); Wed, 4 Apr 2018 15:20:39 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:46138 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752268AbeDDTTf (ORCPT ); Wed, 4 Apr 2018 15:19:35 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E4A4981A43B2; Wed, 4 Apr 2018 19:19:34 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-125-89.rdu2.redhat.com [10.10.125.89]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7596694583; Wed, 4 Apr 2018 19:19:34 +0000 (UTC) From: jglisse@redhat.com To: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org Cc: linux-kernel@vger.kernel.org, =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , Andrea Arcangeli Subject: [RFC PATCH 79/79] mm/ksm: set page->mapping to page_ronly struct instead of stable_node. Date: Wed, 4 Apr 2018 15:18:31 -0400 Message-Id: <20180404191831.5378-42-jglisse@redhat.com> In-Reply-To: <20180404191831.5378-1-jglisse@redhat.com> References: <20180404191831.5378-1-jglisse@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 04 Apr 2018 19:19:34 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 04 Apr 2018 19:19:34 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jglisse@redhat.com' RCPT:'' Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jérôme Glisse Set page->mapping to the page_ronly struct instead of stable_node struct. There is no functional change as page_ronly is just a field of stable_node. Signed-off-by: Jérôme Glisse Cc: Andrea Arcangeli --- mm/ksm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mm/ksm.c b/mm/ksm.c index 6085068fb8b3..52b0ae291d23 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include "internal.h" @@ -126,6 +127,7 @@ struct ksm_scan { /** * struct stable_node - node of the stable rbtree + * @ronly: Page read only struct wrapper (see include/linux/page_ronly.h). * @node: rb node of this ksm page in the stable tree * @head: (overlaying parent) &migrate_nodes indicates temporarily on that list * @hlist_dup: linked into the stable_node->hlist with a stable_node chain @@ -137,6 +139,7 @@ struct ksm_scan { * @nid: NUMA node id of stable tree in which linked (may not match kpfn) */ struct stable_node { + struct page_ronly ronly; union { struct rb_node node; /* when node of stable tree */ struct { /* when listed for migration */ @@ -318,13 +321,15 @@ static void __init ksm_slab_free(void) static inline struct stable_node *page_stable_node(struct page *page) { - return PageReadOnly(page) ? page_rmapping(page) : NULL; + struct page_ronly *ronly = page_ronly(page); + + return ronly ? container_of(ronly, struct stable_node, ronly) : NULL; } static inline void set_page_stable_node(struct page *page, struct stable_node *stable_node) { - page->mapping = (void *)((unsigned long)stable_node | PAGE_MAPPING_RONLY); + page_ronly_set(page, stable_node ? &stable_node->ronly : NULL); } static __always_inline bool is_stable_node_chain(struct stable_node *chain)