Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751326AbdLNJde (ORCPT ); Thu, 14 Dec 2017 04:33:34 -0500 Received: from mx2.suse.de ([195.135.220.15]:45269 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750737AbdLNJdd (ORCPT ); Thu, 14 Dec 2017 04:33:33 -0500 Date: Thu, 14 Dec 2017 10:33:32 +0100 From: Michal Hocko To: Anshuman Khandual Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org Subject: Re: [PATCH] mm/mprotect: Add a cond_resched() inside change_pte_range() Message-ID: <20171214093332.GG16951@dhcp22.suse.cz> References: <20171214051021.20880-1-khandual@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171214051021.20880-1-khandual@linux.vnet.ibm.com> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 638 Lines: 21 On Thu 14-12-17 10:40:21, Anshuman Khandual wrote: [...] > diff --git a/mm/mprotect.c b/mm/mprotect.c > index ec39f73..4fce0f5 100644 > --- a/mm/mprotect.c > +++ b/mm/mprotect.c > @@ -144,6 +144,7 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd, > } while (pte++, addr += PAGE_SIZE, addr != end); > arch_leave_lazy_mmu_mode(); > pte_unmap_unlock(pte - 1, ptl); > + cond_resched(); > > return pages; > } I would put this one level up to change_pmd_range to catch large THP backed regions. Something we do in zap_pmd_range. Other than that the patch makes sense to me. -- Michal Hocko SUSE Labs