Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1149030ybz; Fri, 1 May 2020 15:44:19 -0700 (PDT) X-Google-Smtp-Source: APiQypIL0SuZv17HO9ooX8Ndk+6jHTyc5bfEEPOuaufXHcnY0ZXLCguptOH3dTlxV9g4qptNzlUj X-Received: by 2002:a50:9a04:: with SMTP id o4mr5235558edb.289.1588373059616; Fri, 01 May 2020 15:44:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588373059; cv=none; d=google.com; s=arc-20160816; b=0FUxaWdlezwTDg818dcwmZdlsfFQKqY09B2nHo5ZZt8BleDc0dCU4uwB/MdiBawrsH 0jjt9fcjfC9/GSfRbNElVD0uJsXtQ0MeK5SWFuhygYaZa5iGanAt1sc6gW48ql/301PP wRWN3yNx9LJ+3FdSBwYvBYaX/xp9s0UNhWuS+8aERaSqHiBQZaHHJiYCSwwcMAuwR1a6 aPzgOZpW9l7yXS6o8M9YHv8iwkXP20/BVYB5M6PzKW4wUDwFm+15uoLbQ5I0CJYMy+jR w+XE5EDFstbdcseU42NL2lzutktGZsoNYxGRIUAwsAy3n35Ua9JpEfZZbbrVuWNSvWDB /B2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=1YoBrGcOfoWOs/B+m22a2sFXdCiWrExB6slCiIMgKbc=; b=mqrnyM29g/n8QZew6SWdowyiMGTe2Ismq33O/nHqfQv+2WcQy+mrCweOJN3+szvvTS 34+zBIHGMmu0FXNq9QZnjKmIXV5mOmEhz5pQOBsqTMc4J8BkGJigeXPEn4wSJrDDSayZ VGCXm/oTz4GX8KEHrnFWz3r1D+diLB2nDDmnBzhKae4vQBWk+nGWfIWWuaOP5sjD7uuG +75ph09dPlewpgQhpDL0qR+Jwf38gkOH8/Ml/5a/DjIGJYhcEeC+uLh6gVVRSOlb6QlK pQB57IGsKSNP/2QYQCJ8Pimn4oEqrdXwhsFgzsajHA0qp2b5j1lkookDPxOC7HXGg4Mm f2ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cloud.ionos.com header.s=google header.b=jI0xGxBh; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n20si2638059ejr.443.2020.05.01.15.43.52; Fri, 01 May 2020 15:44:19 -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; dkim=pass header.i=@cloud.ionos.com header.s=google header.b=jI0xGxBh; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727029AbgEAWmU (ORCPT + 99 others); Fri, 1 May 2020 18:42:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726841AbgEAWmT (ORCPT ); Fri, 1 May 2020 18:42:19 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0B01C061A0E for ; Fri, 1 May 2020 15:42:18 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id l18so2698577wrn.6 for ; Fri, 01 May 2020 15:42:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.ionos.com; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=1YoBrGcOfoWOs/B+m22a2sFXdCiWrExB6slCiIMgKbc=; b=jI0xGxBhVhqnybezou5wj+pRK5XU0aUq5pyIuEgt1VDoiOBjHDWAeMXBE2CzslyrAV 4kWrhrL7z+puiACbIuYaThmJfB++lY3YmYpSWWquIJSr4y3PF1j5CmDza9rKwoBhnh9i rhvHql0fkniS8CdnKOT8Ev+tI/Jcq1QaftZDRBZtq9RE3tXWWRV5COIo0l4Y/+o7ZIHl F7Yq+FX8U6T5kLbrxfpxBiad1J/SbUcPvazfNRc19Bg/g0HDPc7gjRtqyVTtX8Ey9O5+ 1oMWqKoQb4wUMfzIgUh8STCnfm80SsxxY3ygXHhaHlEBIjJLTehQamZuZuoKhDvlB4rE 8xSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=1YoBrGcOfoWOs/B+m22a2sFXdCiWrExB6slCiIMgKbc=; b=kDhBOg872kmGHPaWXx0hx3Jv9ynEspk8xE6bmye7b9fY8I1twueHgpISJmuaIR0lSV kugB7gv0cvT3whoRWE/oXGUGo9tXXeDSJ6sBNXE0b2uwqQok1u1jPPy/leKXR4GrNMAR ofhtHd3F/XYJVPilrE9N6+UOJoE3oANRS+FPXsTZnW4HW28Z3nEXT8AOWBJb5OXbWbe1 dJnsrjwp8Prt0nkui9mf+dJ3Ees5maytu8w2FhajTh1dtAiYgZAXAzfGs8iI38TRNJEZ PMBGbmfv6zm8q23Ik2mD8pdQ2PzrkTqKq706ZZL7vT1vRFUgW15Y05KBHHp7XLGke/6t b9gQ== X-Gm-Message-State: AGi0PuZ9bYP5I6oH+zq3E65lyw6WLvql9C8gi36hTXpnxnd38KrKfXu7 oY/R8fqbxmportT7XbQDWzsHFQ== X-Received: by 2002:adf:ecc5:: with SMTP id s5mr5112370wro.261.1588372937299; Fri, 01 May 2020 15:42:17 -0700 (PDT) Received: from ?IPv6:2001:16b8:48db:9b00:e80e:f5df:f780:7d57? ([2001:16b8:48db:9b00:e80e:f5df:f780:7d57]) by smtp.gmail.com with ESMTPSA id n7sm1404912wmd.11.2020.05.01.15.42.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 01 May 2020 15:42:15 -0700 (PDT) Subject: Re: [RFC PATCH V2 0/9] Introduce attach/clear_page_private to cleanup code To: Matthew Wilcox Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, hch@infradead.org, david@fromorbit.com References: <20200430214450.10662-1-guoqing.jiang@cloud.ionos.com> <20200501221626.GC29705@bombadil.infradead.org> From: Guoqing Jiang Message-ID: <889f9f82-64ba-50b3-147b-459303617aeb@cloud.ionos.com> Date: Sat, 2 May 2020 00:42:15 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200501221626.GC29705@bombadil.infradead.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/2/20 12:16 AM, Matthew Wilcox wrote: > On Thu, Apr 30, 2020 at 11:44:41PM +0200, Guoqing Jiang wrote: >> include/linux/pagemap.h: introduce attach/clear_page_private >> md: remove __clear_page_buffers and use attach/clear_page_private >> btrfs: use attach/clear_page_private >> fs/buffer.c: use attach/clear_page_private >> f2fs: use attach/clear_page_private >> iomap: use attach/clear_page_private >> ntfs: replace attach_page_buffers with attach_page_private >> orangefs: use attach/clear_page_private >> buffer_head.h: remove attach_page_buffers > I think mm/migrate.c could also use this: > > ClearPagePrivate(page); > set_page_private(newpage, page_private(page)); > set_page_private(page, 0); > put_page(page); > get_page(newpage); > Thanks for checking!  Assume the below change is appropriate. diff --git a/mm/migrate.c b/mm/migrate.c index 7160c1556f79..f214adfb3fa4 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -797,10 +797,7 @@ static int __buffer_migrate_page(struct address_space *mapping,         if (rc != MIGRATEPAGE_SUCCESS)                 goto unlock_buffers; -       ClearPagePrivate(page); -       set_page_private(newpage, page_private(page)); -       set_page_private(page, 0); -       put_page(page); +       set_page_private(newpage, detach_page_private(page));         get_page(newpage);         bh = head; Cheers, Guoqing