Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758109AbdLRIlX (ORCPT ); Mon, 18 Dec 2017 03:41:23 -0500 Received: from mx2.suse.de ([195.135.220.15]:52612 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751457AbdLRIlW (ORCPT ); Mon, 18 Dec 2017 03:41:22 -0500 Date: Mon, 18 Dec 2017 09:41:19 +0100 From: Michal Hocko To: "Kirill A. Shutemov" Cc: Yang Shi , kirill.shutemov@linux.intel.com, hughd@google.com, aarcange@redhat.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: thp: use down_read_trylock in khugepaged to avoid long block Message-ID: <20171218084119.GJ16951@dhcp22.suse.cz> References: <1513281203-54878-1-git-send-email-yang.s@alibaba-inc.com> <20171215102753.GY16951@dhcp22.suse.cz> <13f935a9-42af-98f4-1813-456a25200d9d@alibaba-inc.com> <20171216114525.GH16951@dhcp22.suse.cz> <20171216200925.kxvkuqoyhkonj7m6@node.shutemov.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171216200925.kxvkuqoyhkonj7m6@node.shutemov.name> 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: 935 Lines: 26 On Sat 16-12-17 23:09:25, Kirill A. Shutemov wrote: > On Sat, Dec 16, 2017 at 12:45:25PM +0100, Michal Hocko wrote: > > On Sat 16-12-17 04:04:10, Yang Shi wrote: [...] > > > Shall we add "cond_resched()" in unmap_vmas(), i.e for every 100 vmas? It > > > may improve the responsiveness a little bit for non-preempt kernel, although > > > it still can't release the semaphore. > > > > We already do, once per pmd (see zap_pmd_range). > > It doesn't help. We would need to find a way to drop mmap_sem, if we're > holding it way too long. And doing it on per-vma count basis is not right > call. It won't address issue with single huge vma. Absolutely agreed. I just wanted to point out that a new cond_resched is not really needed. One way to reduce the lock starvation is to use range locking. > Do we have any instrumentation that would help detect starvation on a > rw_semaphore? I am afraid we don't. -- Michal Hocko SUSE Labs