Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp669648imu; Thu, 22 Nov 2018 03:40:49 -0800 (PST) X-Google-Smtp-Source: AFSGD/Ws6dx/gywA6EQRjCFQIns74hWHP9kZBfXhEkDLz510jmwsYZkM2/PM/B1fMGsAn6p2gdt2 X-Received: by 2002:a17:902:9a42:: with SMTP id x2-v6mr10843591plv.126.1542886849014; Thu, 22 Nov 2018 03:40:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542886848; cv=none; d=google.com; s=arc-20160816; b=cVqhkr5uUB/QhQRk77OigZgRZ5JqRGBO/WRdBQU5K+LseSRruuv0vANIaTpQ578aPA TnYVg+cukbvQD0FsQNsQQisNZ/xIVH7Z65mtG2SjvSV2fsDOEFa1iWpVtiUpHqN/PQ/Z LVS79Bk3eWJgzfr+qa2Is4imaWAK6f5m0WfVhSTfOUilpd2uMKXV/LvBs+4bPA93x5S2 1cOWBW+YLNjQuoluN81V7W92YeKdM1zMpWNR/OU4a+u8JcJwLlahrZXmyHpyiicue5kQ 05HBs5gfxmRIzDgsZG7CXlCiwvv7WsgcpG/BFgcdiWMEgW5t8Z2RJ7rWzkVN0g54RRoK 7Kbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=ADKGYDHn6fLUM+W3Um9nZZcc/gDZN2CQmr/xArmZh2A=; b=WJHjud9kjRNr5vh/4HFrWbtYWhlnl83N4RqXYRdfg4FxPMBGAzYO/eG7sogp86GmPE 4ytX2aYObEao1ovLPK6HzJGJutvCZAPry+Rxb5CG7V7cZDLj1HNYd3amnyFiDX+K7Lxj Ub9kBrhJs8WeisLkFcEqsrZ1ACwIMJrdGRtfLNW00V+v0M37m2vKQncjIfSrNyxo3xHy KGaZpa1GKUWkhcvqjroM3WDKeY2JRZ+3vyXBDLiCJoxOCnB0cCyK8/D+HRQF5HUSxd1d Yf/qKf3Q4PZKZ2ZaUi0NrKg1j96al5SjMUTfKmh3K7GJ9aLaih13XOAUFWFsfakg3MJN 1K1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=i5YIYZTI; 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 p5-v6si22114500plo.7.2018.11.22.03.40.33; Thu, 22 Nov 2018 03:40:48 -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=i5YIYZTI; 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 S2391100AbeKVLNf (ORCPT + 99 others); Thu, 22 Nov 2018 06:13:35 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:42280 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732226AbeKVLNf (ORCPT ); Thu, 22 Nov 2018 06:13:35 -0500 Received: by mail-pl1-f193.google.com with SMTP id x21-v6so7788368pln.9 for ; Wed, 21 Nov 2018 16:36:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=ADKGYDHn6fLUM+W3Um9nZZcc/gDZN2CQmr/xArmZh2A=; b=i5YIYZTIybnReyjAaRthrVbSgSDEkAz5q/AzgQf962JVVBRuK1geeeiUU2WdlxkNit jzS5aFG2M6lZW+eVkLB9KTJBnLJoLHE7fnC3gM/gQkCtbyvhaze7gadi9p728P/TSNhr 7zo3tkLYdrsfKWiv1ur9IpxVto0eEJtDkPHUJKxnlbiTRTbh1tX0vVlBgq2i4gK9fGpL TDjlXLem38WBTAs9dToQh5Kz/0mXywUyRocXRSOsxtKHblVDhwXwV8O/bOnkeDqB0rBx e4fvUMdyhLLZ0Pu8G4fPMllvSGS5OLR09Ienjzcg3o9nfJPYO+MRxfAj/adOwCW56G+q BK2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=ADKGYDHn6fLUM+W3Um9nZZcc/gDZN2CQmr/xArmZh2A=; b=Je/ehu4apGgWjRlkwgs9Fy+C4RO5o13kfL5B6tx8LKhT3YLMR84rc1OyzF2p1CIByj 6n1RuCarQ7x9q/lTigltEfnkHddoQ2vepwHWanGLAsAKke8Cbai6/uGyYQwIE1ebc21x F6sG+6HydqdJx4NDFd5GKVKa9vrvZatahQmI1VEhgTNYx60tThBKUN2QaW3L/8s61ORl bs3vqi3Zz2brNniOEuUDJVaxYe07lhGy7W97zifwMWmfJ8ObrzR7V5eTkwZKTE0aeaQw oeBGbrK3bzka/Gz4SgMFrsnQyYvzQiuNU/kDC/ZvH4eoziLwE39/H57/y14tOMM3Hna7 tcrQ== X-Gm-Message-State: AA+aEWZUws+dNG0zHWA1xHPTaG9VGaJHdEJMIR+kyET3qAVRr4r8KKgk g0dMBG6ALhxw4hEBLZLSJzUljA== X-Received: by 2002:a17:902:9a91:: with SMTP id w17-v6mr8632479plp.274.1542847007755; Wed, 21 Nov 2018 16:36:47 -0800 (PST) Received: from [100.112.89.103] ([104.133.8.103]) by smtp.gmail.com with ESMTPSA id t66sm28256192pfd.54.2018.11.21.16.36.46 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Nov 2018 16:36:46 -0800 (PST) Date: Wed, 21 Nov 2018 16:36:37 -0800 (PST) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Yu Zhao cc: Hugh Dickins , Andrew Morton , Matthew Wilcox , stable@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] mm: use swp_offset as key in shmem_replace_page() In-Reply-To: <20181121215442.138545-1-yuzhao@google.com> Message-ID: References: <20181119010924.177177-1-yuzhao@google.com> <20181121215442.138545-1-yuzhao@google.com> User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 21 Nov 2018, Yu Zhao wrote: > 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 Acked-by: Hugh Dickins Thanks! > --- > 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