Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp508668imu; Thu, 22 Nov 2018 00:48:18 -0800 (PST) X-Google-Smtp-Source: AFSGD/UhULxb8n4+/fLEe9SEZeaFJSsr8Jysjh5CixMljknjLFXeHTupy0dYYCTAr1XyA3M5esP5 X-Received: by 2002:a17:902:bd4a:: with SMTP id b10mr10399441plx.232.1542876498571; Thu, 22 Nov 2018 00:48:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542876498; cv=none; d=google.com; s=arc-20160816; b=NSUXwJrF+1cw7tvaP5Qzv4MqoztijgXaks8cLsbOXpVXStGTnJmiM0bNz0VX4yWTGm jZDKNOadeRIjfy7p+1ter1oBI6G69HpgpypY9bJCGUWuwfWCqKSkPVuas25O6FLAUMPe HdxzfBdxnAqNoU4En58R59QLVIA3DBrhD9yxoKETWpuNOuELDmf9sfHLFATJf2EYbEOw QhsjA6Pg44GExgExUv2xx1OUicXYqc+rjklZbEH8doxjBAN0xESE8cq0NUBhG4EeBkvy Eg29a5eYVo2izylccpS4jZfOiwFArWrs9bF9sUwxChyhOZc0Ib2/E5ZfenbkDetj3y3Q 8ctg== 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 :dkim-signature; bh=L0Df52YKcoq8bv8YlNhyqk1lTtReHKRExwnYBZ1Z0Bo=; b=bNLpcjGJGMOcHWK5oFirwNGgfL4DAWQwGDs22EFdIHbqQTRYHPLZe1qCLLJOKqGRMK 9jO5iAbxX8VgZWgebIhGHQNOU8GOplNNvtm9Mp2zmLoB/O7lSe3YlsfqWGQ5rNbVj2Re 7wJ3pG46NebuQcOISdyYQ6hSym9f/XvEoI0qBlSFop74i9Tl+sAMFhqvr1tSE+7I89KI fq6VLUJpQkDvrPfuwRF+k1Su1gu2I9UumW3jkKkb3e5vB5O7uld8fat6ktd2rnapSwnH fPxVJdHKD6cYs3bPsPv7M2suyEyKLT3U4k9l5XXZT1w4DLIvDwThICvZ3vUdPZq3PpZM D9LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=lPq1BygM; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g6si43438527pgn.57.2018.11.22.00.48.04; Thu, 22 Nov 2018 00:48:18 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=lPq1BygM; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389938AbeKVIa6 (ORCPT + 99 others); Thu, 22 Nov 2018 03:30:58 -0500 Received: from mail-io1-f66.google.com ([209.85.166.66]:34395 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731712AbeKVIa5 (ORCPT ); Thu, 22 Nov 2018 03:30:57 -0500 Received: by mail-io1-f66.google.com with SMTP id f6so5200252iob.1 for ; Wed, 21 Nov 2018 13:54:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=L0Df52YKcoq8bv8YlNhyqk1lTtReHKRExwnYBZ1Z0Bo=; b=lPq1BygMDDfKlEgfu9t5zjgld8jO/q6ohZ7y2YIzgXHnpS9QnRVCZEdA8UHKLc6INm ySw8rsSsVB1u6L/ZuSOEqaXyr50CJZsL9Iv66mvLsHr1aKtivHFIBdxkyNr/VJ5kAPzI k4n0W5QDOEhEzMI8zUkaXT1H6OJCMKFoIjRgStb087DwGAXxvYJpErzSHG67r3kvujAe I+XX6P2sWEW8B3K0d9DzvjANuQv0oorGFjL5KGx+HY5E59FYT1Z5RHG+9NHNBJqVTWrQ zGMNUMu0zDPKMXWemdPNHfRMXSGOLkIsGDPYD24hXAlQxEyYZ8/XjK9RneoSlYSTwZRl lhRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=L0Df52YKcoq8bv8YlNhyqk1lTtReHKRExwnYBZ1Z0Bo=; b=tbBTqhNym1R2ZtYN36nsbfoUYQJup1HZEtpRJxf5YPwvlZVb8z8sQg9RBDNHQKujdK 6C1OPZ1OwzQ5gUzvW0atzfhQC8g2CbrYrW8aZlT6qdPgs3U3YcgsQ2pErUYgbVuxm4Y8 X7MXPl5x50oXmgl1ks5FpN/K5eYQVIAk7ffgRFn2wMR3SP3jp/3c/2C9+CC2TmxbxxmB pRYShRum+AQpGK0MYH+q6VejyccKEiPLswiagMLzd0EgM/KiGYAsBOjcXD8ilO9MXDX0 oKs47N0S/J/qrrrzQeTf4qz0CDc/Gpd+S9Do/62H1p+tWO/oQOc0zaf96/YzjnLgmtoA 4PHQ== X-Gm-Message-State: AA+aEWYWD3Xc2TfkdAyPCMr3dyBLSzSefzPp8HeY81+CVy9a84cgnF1D 5N7uVZCNCXWxmwx7yX4GDPJMMw== X-Received: by 2002:a6b:710b:: with SMTP id q11mr5448132iog.138.1542837286843; Wed, 21 Nov 2018 13:54:46 -0800 (PST) Received: from yuzhao.bld.corp.google.com ([2620:15c:183:0:a0c3:519e:9276:fc96]) by smtp.gmail.com with ESMTPSA id 142-v6sm1113716itw.40.2018.11.21.13.54.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Nov 2018 13:54:45 -0800 (PST) From: Yu Zhao To: Hugh Dickins Cc: Andrew Morton , Matthew Wilcox , stable@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yu Zhao Subject: [PATCH v3] mm: use swp_offset as key in shmem_replace_page() Date: Wed, 21 Nov 2018 14:54:42 -0700 Message-Id: <20181121215442.138545-1-yuzhao@google.com> X-Mailer: git-send-email 2.19.1.1215.g8438c0b245-goog In-Reply-To: <20181119010924.177177-1-yuzhao@google.com> References: <20181119010924.177177-1-yuzhao@google.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We changed key of swap cache tree from swp_entry_t.val to swp_offset. Need to do so in shmem_replace_page() as well. Fixes: f6ab1f7f6b2d ("mm, swap: use offset of swap entry as key of swap cache") Cc: stable@vger.kernel.org # v4.9+ Signed-off-by: Yu Zhao --- mm/shmem.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index d44991ea5ed4..42b70978e814 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1509,11 +1509,13 @@ static int shmem_replace_page(struct page **pagep, gfp_t gfp, { struct page *oldpage, *newpage; struct address_space *swap_mapping; + swp_entry_t entry; pgoff_t swap_index; int error; oldpage = *pagep; - swap_index = page_private(oldpage); + entry.val = page_private(oldpage); + swap_index = swp_offset(entry); swap_mapping = page_mapping(oldpage); /* @@ -1532,7 +1534,7 @@ static int shmem_replace_page(struct page **pagep, gfp_t gfp, __SetPageLocked(newpage); __SetPageSwapBacked(newpage); SetPageUptodate(newpage); - set_page_private(newpage, swap_index); + set_page_private(newpage, entry.val); SetPageSwapCache(newpage); /* -- 2.19.1.1215.g8438c0b245-goog