From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757009AbcG0P0U (ORCPT ); Wed, 27 Jul 2016 11:26:20 -0400 Received: from mga09.intel.com ([134.134.136.24]:62797 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753587AbcG0P0T (ORCPT ); Wed, 27 Jul 2016 11:26:19 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,430,1464678000"; d="scan'208";a="1024957165" Subject: Re: [RFC PATCH] mm/hugetlb: Avoid soft lockup in set_max_huge_pages() To: hejianet , linux-mm@kvack.org References: <1469547868-9814-1-git-send-email-hejianet@gmail.com> <579788BA.1040706@linux.intel.com> <579810E7.6060601@gmail.com> Cc: linux-kernel@vger.kernel.org, Andrew Morton , Naoya Horiguchi , Mike Kravetz , "Kirill A. Shutemov" , Michal Hocko , Paul Gortmaker From: Dave Hansen Message-ID: <5798D299.4090904@linux.intel.com> Date: Wed, 27 Jul 2016 08:26:17 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <579810E7.6060601@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/26/2016 06:39 PM, hejianet wrote: >>> >> and you choose to patch both of the alloc_*() functions. Why not just >> fix it at the common call site? Seems like that >> spin_lock(&hugetlb_lock) could be a cond_resched_lock() which would fix >> both cases. > I agree to move the cond_resched() to a common site in > set_max_huge_pages(). But do you mean the spin_lock in this while > loop can be replaced by cond_resched_lock? IIUC, cond_resched_lock = > spin_unlock+cond_resched+spin_lock. So could you please explain more > details about it? Thanks. Ahh, good point. A plain cond_resched() outside the lock is probably sufficient here.