Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3318164imu; Sun, 11 Nov 2018 12:15:04 -0800 (PST) X-Google-Smtp-Source: AJdET5eTTDtotgm2KmMVABuF5N/oQS77bIBr8UjZLHb7LhLw8zloX9oAKwUN+ViZB0FBCgivbAq0 X-Received: by 2002:a17:902:104:: with SMTP id 4-v6mr17731753plb.184.1541967304697; Sun, 11 Nov 2018 12:15:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541967304; cv=none; d=google.com; s=arc-20160816; b=GO8f72zRvVJEgX0gSdIcDLLbBh4ZJPhDjhJAloNRCVUJqegywPeatTwuZZKDhXofxy eH114xtyK0NXVu+a6ghxIjb4KKBmgergYeiCfGyOvOQRSe2aE2DCgvDWmCeCxLHHq3bs DkGPRFZooYPmA/x+T1tCdx2geEU+N6oB9ku7fy3jui6JqOkrV6dUY4nLBPYtt2HQPY7X 7JoAco2n2ndEi75eMxE3e7HqqdxGpmqAFmTdrNZRvr47kzD1p8P4yPXdx2EOxINbgdb5 reTJJfYaSut7ieylOztBijLdHW9xSGoSoJ2r0CJMtcRC51+sYDZP4tW6XEOiaeUj+pKo 9+XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=1GUGjPovDGwuqUFWrRrjdtJa51OIcn9E8TzgJK/qCVI=; b=stbttEyRsEFnEwKUWcLbhxNgeiW1p0K1iRgF8JSuvs+NhPd6Nhal9XI7NhGcKCWuU7 S3OvlOOuMi71IWDyLkRFIKOlmYNAEaKUIe3nKfrWkAJWZrK2zqo5ksRfZH8Q0ZgqdA5c lP6pB7/yMBKLI7a/lhhLCrSK82HIQZuGgCHThRvLdsssUI7Y9w/lAIBHu0rlh9+X3xRQ 13jI1EaZvp6tKkrnPXOxy9+X9nBHKgmBAqEQQxn8KVpcolikXMQtiR82u8ZlZ4cIjjvX nktN1rAB51HDSo7UDh9VxLzIDno8sOJvfQ31EplU8x9NuQWqyUSRE7vNb4rjcJXNpgqG jOdA== ARC-Authentication-Results: i=1; mx.google.com; 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 o9-v6si5364664plk.434.2018.11.11.12.14.46; Sun, 11 Nov 2018 12:15:04 -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; 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 S1731483AbeKLGCb (ORCPT + 99 others); Mon, 12 Nov 2018 01:02:31 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:52662 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726709AbeKLGCa (ORCPT ); Mon, 12 Nov 2018 01:02:30 -0500 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gLvt1-0000oN-Lr; Sun, 11 Nov 2018 19:59:11 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gLvsS-0001Xl-2o; Sun, 11 Nov 2018 19:58:36 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Hugh Dickins" , "Andrea Arcangeli" , "Petr Holasek" , "Linus Torvalds" , "Davidlohr Bueso" Date: Sun, 11 Nov 2018 19:49:05 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 135/366] ksm: add cond_resched() to the rmap_walks In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.61-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Andrea Arcangeli commit ad12695f177c3403a64348b42718faf9727fe358 upstream. While at it add it to the file and anon walks too. Signed-off-by: Andrea Arcangeli Acked-by: Hugh Dickins Cc: Petr Holasek Acked-by: Davidlohr Bueso Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Ben Hutchings --- mm/ksm.c | 2 ++ mm/rmap.c | 4 ++++ 2 files changed, 6 insertions(+) --- a/mm/ksm.c +++ b/mm/ksm.c @@ -1915,9 +1915,11 @@ again: struct anon_vma_chain *vmac; struct vm_area_struct *vma; + cond_resched(); anon_vma_lock_read(anon_vma); anon_vma_interval_tree_foreach(vmac, &anon_vma->rb_root, 0, ULONG_MAX) { + cond_resched(); vma = vmac->vma; if (rmap_item->address < vma->vm_start || rmap_item->address >= vma->vm_end) --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1486,6 +1486,8 @@ static int rmap_walk_anon(struct page *p struct vm_area_struct *vma = avc->vma; unsigned long address = vma_address(page, vma); + cond_resched(); + if (rwc->invalid_vma && rwc->invalid_vma(vma, rwc->arg)) continue; @@ -1533,6 +1535,8 @@ static int rmap_walk_file(struct page *p vma_interval_tree_foreach(vma, &mapping->i_mmap, pgoff, pgoff) { unsigned long address = vma_address(page, vma); + cond_resched(); + if (rwc->invalid_vma && rwc->invalid_vma(vma, rwc->arg)) continue;