From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC082C433E2 for ; Tue, 8 Sep 2020 19:05:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B904D206DB for ; Tue, 8 Sep 2020 19:05:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599591931; bh=6W5PImKoQy+Nd3zNLvrudh8+VVaCoLUFwkeOePG+JDg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ok8ybWR/BC2M5u67ZjupUpq6uqJNY6/iWHY7zCaVtBRee4nH2uBZEMsZOhZOmXoqr sx53uM0ZRbCYp+5z8R6/InqIxa5PgzVCuAGYoSORl/y9ug5f6mzoGdHLeysYoC2QO9 /GMddoLhbcJU7roA0x5F1e5MaWUOsRkCpoIywBBY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731752AbgIHTFY (ORCPT ); Tue, 8 Sep 2020 15:05:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:52116 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731261AbgIHQHV (ORCPT ); Tue, 8 Sep 2020 12:07:21 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 9BBE023E22; Tue, 8 Sep 2020 15:46:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599580019; bh=6W5PImKoQy+Nd3zNLvrudh8+VVaCoLUFwkeOePG+JDg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MhwsyZBbEtFzyajjNq8cgdX6RTNA9umV2RytS2qJLy5b8MYPNkJB0XzlZj2mVinda nCVrd3SCIwcjqc85OX+HaN4+860f+Oj8U8OHp8mwqql/bV4B5vrx4JIyevf+Z2U3np lUyPeswG54whwdFRtgQ4IijJbIihlh908hg50qt0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Howells , "Matthew Wilcox (Oracle)" , Andrew Morton , Song Liu , Yang Shi , Pankaj Gupta , Eric Biggers , Linus Torvalds Subject: [PATCH 5.4 127/129] mm/khugepaged.c: fix khugepageds request size in collapse_file Date: Tue, 8 Sep 2020 17:26:08 +0200 Message-Id: <20200908152236.212996375@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200908152229.689878733@linuxfoundation.org> References: <20200908152229.689878733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David Howells commit e5a59d308f52bb0052af5790c22173651b187465 upstream. collapse_file() in khugepaged passes PAGE_SIZE as the number of pages to be read to page_cache_sync_readahead(). The intent was probably to read a single page. 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 Signed-off-by: Matthew Wilcox (Oracle) Signed-off-by: Andrew Morton Reviewed-by: Matthew Wilcox (Oracle) Acked-by: Song Liu Acked-by: Yang Shi Acked-by: Pankaj Gupta Cc: Eric Biggers Link: https://lkml.kernel.org/r/20200903140844.14194-2-willy@infradead.org Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- mm/khugepaged.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -1592,7 +1592,7 @@ static void collapse_file(struct mm_stru 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);