Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753483AbdLTBfz (ORCPT ); Tue, 19 Dec 2017 20:35:55 -0500 Received: from out0-200.mail.aliyun.com ([140.205.0.200]:50266 "EHLO out0-200.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751559AbdLTBfx (ORCPT ); Tue, 19 Dec 2017 20:35:53 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R651e4;CH=green;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e02c03311;MF=yang.s@alibaba-inc.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---.9nLJE17_1513733739; Subject: Re: [PATCH] mm: thp: use down_read_trylock in khugepaged to avoid long block To: Michal Hocko , "Kirill A. Shutemov" Cc: kirill.shutemov@linux.intel.com, hughd@google.com, aarcange@redhat.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org 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> <20171218084119.GJ16951@dhcp22.suse.cz> From: "Yang Shi" Message-ID: <155d6243-8219-3a8a-826c-0f0480639274@alibaba-inc.com> Date: Wed, 20 Dec 2017 09:35:39 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20171218084119.GJ16951@dhcp22.suse.cz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1033 Lines: 31 On 12/18/17 12:41 AM, Michal Hocko wrote: > 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. It looks the range locking development is stalled? Yang > >> Do we have any instrumentation that would help detect starvation on a >> rw_semaphore? > > I am afraid we don't. >