Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4158259pxk; Tue, 8 Sep 2020 12:09:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHfM03bL2Q8qGZ7FN3HsG+UKG2k7YZIS0R6jzit4VRgvcp31cl/7gOF7zM0gB6sT0V4zxQ X-Received: by 2002:a50:d942:: with SMTP id u2mr531673edj.0.1599592192630; Tue, 08 Sep 2020 12:09:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599592192; cv=none; d=google.com; s=arc-20160816; b=d1mn83+mM6kHEwlbyXCsEfjo1f9vWbilUyGPQ4yF9RYGgMbX7eIo8WewuFBhXx+KUQ 8hLMQdXM80J+VrG5omovSrolsTU7x1cvMAhlMMygBUdtVwkg172o0+Q4YmqQQgNK2dm7 K0/5IZLY+KgoHJT+ZyVjoq0BhOs+exIb15QtkA2exxJtmVqbM6ftjk4oxgRBilPIUJMz 0o6HeoRRYeOGp/tCelotSxh9aGAVV/lwd9euTbsYm63snzjDs7qWSQrU2xqTXkogc+9j XArvB+c9WxbYlEGJXWb7akrPBNlqvxhSQ1p8VaLtYfyUpBPWpFCQjszb9gpgfcQNO+NC tIMg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qdXRIEgdYQjSlh6ciwKJ+3dzdZijiAaWL+CYvrlK1uI=; b=FLOo5me5eaW1+hPM9FhyseP4OwUCONiOKhz9DU+rlYpzo3lX5DLQeoRqHlnEppH9Lz EJQ8SA7riD7fBZ9nYrwyivteaglCF7ujUTFck9VoOR9pFRuDCK5UTSKgwI5LsOLZ50hS 5ytSYTEQoqhyaythErXqDQ6h2l7M3rckXPCX/ZucxdhR4vLydmTtryeI6wbzCtIXyQRJ ++4rjZYoCdyMFBt4TF3kjfGDZH1xadSdSpf83fg6PtPyOPsCg+WcuDqUG9fYmzAoyrfi zWqWLRm9Xr56mk29FGR+QXmct6o0p9Rb4rJ1FhaoKCb3oQCbO9TFImuLZWiapfUKZpKn In7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MhwsyZBb; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w16si12417115eje.414.2020.09.08.12.09.29; Tue, 08 Sep 2020 12:09:52 -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=MhwsyZBb; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731746AbgIHTFY (ORCPT + 99 others); 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);