Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753784AbbGSMcw (ORCPT ); Sun, 19 Jul 2015 08:32:52 -0400 Received: from mx2.parallels.com ([199.115.105.18]:48474 "EHLO mx2.parallels.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932102AbbGSMcs (ORCPT ); Sun, 19 Jul 2015 08:32:48 -0400 From: Vladimir Davydov To: Andrew Morton CC: Andres Lagar-Cavilla , Minchan Kim , Raghavendra K T , Johannes Weiner , Michal Hocko , Greg Thelen , Michel Lespinasse , David Rientjes , Pavel Emelyanov , Cyrill Gorcunov , Jonathan Corbet , , , , , Subject: [PATCH -mm v9 8/8] proc: add cond_resched to /proc/kpage* read/write loop Date: Sun, 19 Jul 2015 15:31:17 +0300 Message-ID: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.24.25.231] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1613 Lines: 64 Reading/writing a /proc/kpage* file may take long on machines with a lot of RAM installed. Suggested-by: Andres Lagar-Cavilla Signed-off-by: Vladimir Davydov --- fs/proc/page.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/proc/page.c b/fs/proc/page.c index 13dcb823fe4e..7ff7cba8617b 100644 --- a/fs/proc/page.c +++ b/fs/proc/page.c @@ -58,6 +58,8 @@ static ssize_t kpagecount_read(struct file *file, char __user *buf, pfn++; out++; count -= KPMSIZE; + + cond_resched(); } *ppos += (char __user *)out - buf; @@ -219,6 +221,8 @@ static ssize_t kpageflags_read(struct file *file, char __user *buf, pfn++; out++; count -= KPMSIZE; + + cond_resched(); } *ppos += (char __user *)out - buf; @@ -267,6 +271,8 @@ static ssize_t kpagecgroup_read(struct file *file, char __user *buf, pfn++; out++; count -= KPMSIZE; + + cond_resched(); } *ppos += (char __user *)out - buf; @@ -421,6 +427,7 @@ static ssize_t kpageidle_read(struct file *file, char __user *buf, idle_bitmap = 0; out++; } + cond_resched(); } *ppos += (char __user *)out - buf; @@ -467,6 +474,7 @@ static ssize_t kpageidle_write(struct file *file, const char __user *buf, put_page(page); } } + cond_resched(); } *ppos += (const char __user *)in - buf; -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/