Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1931537pxk; Tue, 1 Sep 2020 11:08:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxm43/A94m6Bb6IgHnaPOHFovMi2Sx28JdIQJmoIf5788wQ6okqPXBhC6OIuq6I7Egt4XKC X-Received: by 2002:a17:906:2bdb:: with SMTP id n27mr2768678ejg.12.1598983695902; Tue, 01 Sep 2020 11:08:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598983695; cv=none; d=google.com; s=arc-20160816; b=JDPK8HEM29KVNocFr+uLVTa7mWOokwRw9KmQQPl+U5Q9/UxICt5PmjCW8Y2vE9KWOi zb5g2o1nHejpST5ofP/QjEZlElzJBK//ZinGm53+XspYFArukb4BP5QxVLq1tPaxQilk 5zypIChzL6iOGZLhLM3vGfYEaEZKpWfBU5keDs4Ehtgv7plx7Yku/dKEm6HXr+EJftgq bsszd3LyjLGkKjxgORQbCE7G3+nA8aL82696IJ+apFY6JBvT50iW8ZL/evGs9xPj5cWb Bbgp234SluwRcvAOUR+KOGl8CPyzfEMkjA61HBfuArtpFTDyw4MGDtYHgBCTXhiwhbRH 8gCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=zEDrX0VigRnbVX+e+DcmXj+6CL8IU1XoVY9YjsXAOiQ=; b=bJaaE8c2bfExJ8mhvcSM5nYWNtxftXF2vrVTVdoaY2QrOc5nkN4awZnIpAfFsVJAxk uNJyDfcoRb9Ih+JHSvueLNlzxBHJB5DkXI7mlSPduUM48wjnExQgEf7cFL92I9rRz/jK LVE2db/1bqJREcm6qIOHwrqOv7irDynAnxiWQH26TH5CVjSO4mO8gfF+spACyYh6928v SRXUKosSsVNXflOiYh1resRLiIHj/drS7z9A2X4rn9N+eZ1WZSpc6umT6goEzaSzJZfl bZjnscgufz6tuy7+j75uoGcNlYUpxSAvh8U5FCf+UfZyfB5fchqaBlvvURzqakFtwLfh A34A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uFvkOFoR; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a12si1149543eje.638.2020.09.01.11.07.51; Tue, 01 Sep 2020 11:08:15 -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=@kernel.org header.s=default header.b=uFvkOFoR; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729756AbgIASGs (ORCPT + 99 others); Tue, 1 Sep 2020 14:06:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:57134 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726377AbgIASGq (ORCPT ); Tue, 1 Sep 2020 14:06:46 -0400 Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F0CB020866; Tue, 1 Sep 2020 18:06:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598983605; bh=2Lfvmfq4ZZ/+WMJSiH8u8cZm0zraIa4vbzwb4dTfe0g=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=uFvkOFoR7ee4CiEr9FYKckMkQuvtj01lK9phDiqWKg63igqVY2m+VnySzKWdLQdRj KIj5gxNLWlU2NoVo21kbPij9slwCdGbc2Ql33UmGdp8SC6gEdYXZ44zsW7MabKWHAw sJzWV6FSKaAfftthbnIYUgx7rpgxUa8s0NYC6KtI= Received: by mail-lj1-f174.google.com with SMTP id k25so2652722ljg.9; Tue, 01 Sep 2020 11:06:44 -0700 (PDT) X-Gm-Message-State: AOAM532t0xGUhqUeZtXOZ9x3s6/UxyS/Pw3WXV0fuRUp+6La3AFJaDTm xtQcuY0f7nrKo6Egsj8Y8uKJdwTNtOPwUnaZWNs= X-Received: by 2002:a2e:81c2:: with SMTP id s2mr1257862ljg.10.1598983603083; Tue, 01 Sep 2020 11:06:43 -0700 (PDT) MIME-Version: 1.0 References: <159897769535.405783.17587409235571100774.stgit@warthog.procyon.org.uk> <159897770245.405783.16506873187032379873.stgit@warthog.procyon.org.uk> In-Reply-To: <159897770245.405783.16506873187032379873.stgit@warthog.procyon.org.uk> From: Song Liu Date: Tue, 1 Sep 2020 11:06:31 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH 1/7] Fix khugepaged's request size in collapse_file() To: David Howells Cc: Matthew Wilcox , Linux-Fsdevel , Linux-MM , open list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 1, 2020 at 9:28 AM David Howells wrote: > > collapse_file() in khugepaged passes PAGE_SIZE as the number of pages to be > read ahead to page_cache_sync_readahead(). It seems this was expressed as a > number of bytes rather than a number of pages. > > Fix it to use the number of pages to the end of the window instead. > > Fixes: 99cb0dbd47a1 ("mm,thp: add read-only THP support for (non-shmem) FS") > Signed-off-by: David Howells > cc: Matthew Wilcox > cc: Song Liu Thanks for the fix! Acked-by: Song Liu > --- > > mm/khugepaged.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/khugepaged.c b/mm/khugepaged.c > index 6d199c353281..f2d243077b74 100644 > --- a/mm/khugepaged.c > +++ b/mm/khugepaged.c > @@ -1706,7 +1706,7 @@ static void collapse_file(struct mm_struct *mm, > xas_unlock_irq(&xas); > page_cache_sync_readahead(mapping, &file->f_ra, > file, index, > - PAGE_SIZE); > + end - index); > /* drain pagevecs to help isolate_lru_page() */ > lru_add_drain(); > page = find_lock_page(mapping, index); > > >