Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1239030ybv; Thu, 13 Feb 2020 18:55:31 -0800 (PST) X-Google-Smtp-Source: APXvYqxggzWPr/8IhRPwuZDmAN8RF16VFS2aJWmAyR4vhUostywCJb2prG1jRXjgV1ahi6t99aSL X-Received: by 2002:a05:6830:200d:: with SMTP id e13mr536155otp.364.1581648931383; Thu, 13 Feb 2020 18:55:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581648931; cv=none; d=google.com; s=arc-20160816; b=umENAE9WqvNo4GMl6ss9uUiGLXNllQjKH+rguLJYvT8RaRQ85qGaZHO32hRa9ZcB0f bf9xFEWdpB8tnPbIYp/E4N9/uCySqby5zp7Y3I0jWoZCJAJbqjiEHkQlHnMgrantYrTf TXMFm1QhpeovDlG/AkJSB+8/83Y+/rADksA1ujpyhat1hd2sSkkzdVfcw+f2fhzkDScS TVsCOua1x7nHYJd3K+D6GHh+TzgXYbfSGBJmMXyCIlB8pCoPnzaUBH1skJg3h47CIT+C yxNmYy0ZkDV2MeSSeuaC/9M8s6+QTuNTlmPPSsHy+MypLrggtMGHsnLFdKm6I7xR0E5v UiuA== 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:subject:cc:to:from:date :dkim-signature; bh=bi+uU6UT/US9Dx8G+kwPTaSxnrM1LUUpX2Opj14e6q0=; b=oJzsbaU20IRmoJ5OA8dQpXlTsJB9C1DJI8M1i+WPbK8qFANkLXsHHgnAZkx4z6AFBH 5dFwLP9A2cky2PuAl+FvDxgNKTOpgZToqF/2Voltdwo7iio1ALjJoqlYRkZkncr8KqUQ obdXiuz1I3bnFqH31MAhCFyS4La3+SKlbPBCpHUCPlnZ9DJiB2YXjSf2M9CLjxieP6ET k6eZHCdarDAJB4n15D77/5qP5o8ZBpR2ekNvpar0k1dFpbBOL93cQU07PPFhda2kN/D5 7cZEwx/ve3b1Q7Q5jwZ8GBNwEFqhBGuJ4eNv31ccYorrqtXKiwQUOllKwFZ1RTmxHbkd pAIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=V26bRk+B; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y73si1886462oia.246.2020.02.13.18.55.18; Thu, 13 Feb 2020 18:55:31 -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=@kernel.org header.s=default header.b=V26bRk+B; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728193AbgBNCzP (ORCPT + 99 others); Thu, 13 Feb 2020 21:55:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:37000 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727604AbgBNCzO (ORCPT ); Thu, 13 Feb 2020 21:55:14 -0500 Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 718BB2168B; Fri, 14 Feb 2020 02:55:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581648912; bh=lQDKYAfbCVYkA0WiWbRnkihwJDNeJ9WI1ZHWRFRZfp4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=V26bRk+BUYMdbQqNQyDqSi8eyS8yH4pDIs4smYhZ2SbGazHJkvd++D105I185t9G8 WPwtRBVxjpFV7sXn55HriYsdol54A6FxY9NVI5h5DEjOzaTPFk/o1w1gUiLCBE4m7D Or7O57tp9EiQk8Bgv0HtYmDVDG42qJo707k+2UdQ= Date: Thu, 13 Feb 2020 18:55:11 -0800 From: Andrew Morton To: Yang Shi Cc: willy@infradead.org, mhocko@suse.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: migrate.c: migrate PG_readahead flag Message-Id: <20200213185511.4660aca17553562d764dc7ea@linux-foundation.org> In-Reply-To: <1581640185-95731-1-git-send-email-yang.shi@linux.alibaba.com> References: <1581640185-95731-1-git-send-email-yang.shi@linux.alibaba.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 14 Feb 2020 08:29:45 +0800 Yang Shi wrote: > Currently migration code doesn't migrate PG_readahead flag. > Theoretically this would incur slight performance loss as the > application might have to ramp its readahead back up again. Even though > such problem happens, it might be hidden by something else since > migration is typically triggered by compaction and NUMA balancing, any > of which should be more noticeable. > > Migrate the flag after end_page_writeback() since it may clear > PG_reclaim flag, which is the same bit as PG_readahead, for the new > page. > > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -647,6 +647,14 @@ void migrate_page_states(struct page *newpage, struct page *page) > if (PageWriteback(newpage)) > end_page_writeback(newpage); > > + /* > + * PG_readahead share the same bit with PG_reclaim, the above > + * end_page_writeback() may clear PG_readahead mistakenly, so set > + * the bit after that. > + */ > + if (PageReadahead(page)) > + SetPageReadahead(newpage); > + > copy_page_owner(page, newpage); > Why not if (PageWriteback(newpage)) { end_page_writeback(newpage); /* * PG_readahead share the same bit with PG_reclaim, the above * end_page_writeback() may clear PG_readahead mistakenly, so * set the bit after that. */ if (PageReadahead(page)) SetPageReadahead(newpage); } ?