Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp3294288ybk; Tue, 19 May 2020 00:38:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyc+iIF3fR78QPZ4UvlO+wHzQ4/mZxLmERsNhdUhgLsPl9zm7Iuy+QI10qkK74/PgHawv+M X-Received: by 2002:a05:600c:1403:: with SMTP id g3mr3994054wmi.51.1589873898604; Tue, 19 May 2020 00:38:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589873898; cv=none; d=google.com; s=arc-20160816; b=OED8eWH+LuIxTqmbvEHVhBQ9CmxOO3mdpJCngbwMpAYhlszTX8MaJjI+g8rIUmMZwA HLEfLn78gg0XRCSs1r1vMfZUkAKp142fW97JgK6JAyH9RCG/PeyBE+kK6Sjb/MDa0Jdu ZR+ruNn1hdR959fxtbjzPEjhj9XuuG1JQeg7V1cOF8df7T5cJFdG7S3iwhxIUVqyzqbk RQ3VTCOzuGfYD4iEYCoPygQh0WrfKTDiTIMC7RhbYAjXzyyUTZnqrPd7lcH0Uiy5d1zL qzpH4Q76WsT596+Rk3LL4/ZGcnz+dhPwhbR6XptS9igF2f5EQmGzi5tu0KRJnGCaJRVb bMgQ== 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=2I0Cwdw6DhsE7UCLIzHUkREHb8Z7quMrqFm7k861wNU=; b=Xy8U4DXqjmyU2vncGkd/8hPmQbTM7gRA7XC5mmCEBJaJPKUR/VqmzTlg2hMfQDPd2C FiGWDCmQ0OEiNG7bJ2SauQVjD0/4BIS0BWfyKsjkmt9J1gRwIsO6doOj9iq7/lIxD2i0 8o/QfI+nnQgD/Rk5RpJqi5x4jxt+ZgL94nwHJQJgu/W4Gmt+hcXrzSyREaJ3xOEib9HA O4x8y3dhYFJ9QGoK6+W7xP01vJ8YW5WjXLxePqe8NRJlVx6EYDZYhdn48gFNzpJMI3X7 h+M/8/qOhQ0rfTbWwiovC8GhfQpe83bCQOzPXOuhIMIALqmt27stA8ESQzv+aKT/v5Xp UZlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cloud.ionos.com header.s=google header.b=Zfm+GoDG; 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 dv25si6076070ejb.232.2020.05.19.00.37.56; Tue, 19 May 2020 00:38:18 -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=Zfm+GoDG; 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 S1728431AbgESHgE (ORCPT + 99 others); Tue, 19 May 2020 03:36:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725996AbgESHgE (ORCPT ); Tue, 19 May 2020 03:36:04 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2140EC061A0C for ; Tue, 19 May 2020 00:36:03 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id h4so1935776wmb.4 for ; Tue, 19 May 2020 00:36:03 -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=2I0Cwdw6DhsE7UCLIzHUkREHb8Z7quMrqFm7k861wNU=; b=Zfm+GoDGAh6O02kDPdw+5lm+mfVDoQFoQhO59WXiVOjRyP70rU3Q68xjWYdAH/lRcE gOSWlKUSr7lDTl+t8mLf8NlPFysXqalk8HsdRai1ewWANsIf79IfTkkk292KkmnyCG9t y6enMk0cUjyajrdDRsPizDqg8pEIpcARF25oD+vUqk23qIx9hJFUHLT4ZjFu2nFvMkzY +hqC2D146wcsXnAvkXXdfAhaOig6kK9oSpOm6mBDf/6chopXBgF23EhSrA/sAMAQQfdP GSk+lGzF/sqWsdgYckZgGDRxvGIzc1t1lEAaa7iQRmx/BQMN06FajyELdZtWSi7MAhkQ C6lw== 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=2I0Cwdw6DhsE7UCLIzHUkREHb8Z7quMrqFm7k861wNU=; b=GwAcP+EcgCqgYVLwz8z61XN5N+3hGkajoPv9o9brNgn06B4ETKl0XuayooYExVW9S5 xNiUhfa8gOu5ZBlOEG89fomGiGUGNAwwMV6jOWwElo+zaIU/Y7svOY7waBiMYFBXYJJV VT7dGak7BZDKcs0E0MNUuLKzBYQk45VMEWKcV9K+440AR7y0XuMaN2YUJItVJnDyA65+ yK4N3nXIwan74X073lHLw4zmytQYaxrg4Wlu6fuGN8l6CR7ZXhIg4pn8jc8T0THkyTAq 1KlIbZD8I13lk6lS+S0lHI3b14T8SYZ5gDtYZHiRStTQan+Leuf1lYhd4x5nbTRRodHP i0VQ== X-Gm-Message-State: AOAM531M85lJ5YlSZMMcvbW3GkCYHBUDkhwGbE686siAl5EJSgPHWWFs KmCQ+ZCRJB0O5kWSN24NN8U1gA== X-Received: by 2002:a1c:3585:: with SMTP id c127mr3784958wma.34.1589873760226; Tue, 19 May 2020 00:36:00 -0700 (PDT) Received: from ?IPv6:2001:16b8:4852:3600:e80e:f5df:f780:7d57? ([2001:16b8:4852:3600:e80e:f5df:f780:7d57]) by smtp.gmail.com with ESMTPSA id n9sm19679494wrv.43.2020.05.19.00.35.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 May 2020 00:35:59 -0700 (PDT) Subject: Re: [PATCH 10/10] mm/migrate.c: call detach_page_private to cleanup code To: Andrew Morton Cc: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, david@fromorbit.com, hch@infradead.org, willy@infradead.org References: <20200517214718.468-1-guoqing.jiang@cloud.ionos.com> <20200517214718.468-11-guoqing.jiang@cloud.ionos.com> <20200518221235.1fa32c38e5766113f78e3f0d@linux-foundation.org> From: Guoqing Jiang Message-ID: Date: Tue, 19 May 2020 09:35:59 +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: <20200518221235.1fa32c38e5766113f78e3f0d@linux-foundation.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/19/20 7:12 AM, Andrew Morton wrote: > On Sun, 17 May 2020 23:47:18 +0200 Guoqing Jiang wrote: > >> We can cleanup code a little by call detach_page_private here. >> >> ... >> >> --- a/mm/migrate.c >> +++ b/mm/migrate.c >> @@ -804,10 +804,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; > mm/migrate.c: In function '__buffer_migrate_page': > ./include/linux/mm_types.h:243:52: warning: assignment makes integer from pointer without a cast [-Wint-conversion] > #define set_page_private(page, v) ((page)->private = (v)) > ^ > mm/migrate.c:800:2: note: in expansion of macro 'set_page_private' > set_page_private(newpage, detach_page_private(page)); > ^~~~~~~~~~~~~~~~ > > The fact that set_page_private(detach_page_private()) generates a type > mismatch warning seems deeply wrong, surely. > > Please let's get the types sorted out - either unsigned long or void *, > not half-one and half-the other. Whatever needs the least typecasting > at callsites, I suggest. Sorry about that, I should notice the warning before. I will double check if other places need the typecast or not, then send a new version. > And can we please implement set_page_private() and page_private() with > inlined C code? There is no need for these to be macros. Just did a quick change. -#define page_private(page)             ((page)->private) -#define set_page_private(page, v)      ((page)->private = (v)) +static inline unsigned long page_private(struct page *page) +{ +       return page->private; +} + +static inline void set_page_private(struct page *page, unsigned long priv_data) +{ +       page->private = priv_data; +} Then I get error like. fs/erofs/zdata.h: In function ‘z_erofs_onlinepage_index’: fs/erofs/zdata.h:126:8: error: lvalue required as unary ‘&’ operand   u.v = &page_private(page);         ^ I guess it is better to keep page_private as macro, please correct me in case I missed something. Thanks, Guoqing