From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932706AbcHWItG (ORCPT ); Tue, 23 Aug 2016 04:49:06 -0400 Received: from mx6-phx2.redhat.com ([209.132.183.39]:50715 "EHLO mx6-phx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752596AbcHWItC (ORCPT ); Tue, 23 Aug 2016 04:49:02 -0400 Date: Tue, 23 Aug 2016 04:48:40 -0400 (EDT) From: Pankaj Gupta To: Mel Gorman Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, vbabka@suse.cz, riel@redhat.com, hannes@cmpxchg.org, iamjoonsoo kim , kirill shutemov , izumi taku Message-ID: <529861221.2662345.1471942120576.JavaMail.zimbra@redhat.com> In-Reply-To: <20160819140026.GN8119@techsingularity.net> References: <1471608918-5101-1-git-send-email-pagupta@redhat.com> <20160819124508.GM8119@techsingularity.net> <945408416.2306040.1471612041111.JavaMail.zimbra@redhat.com> <20160819140026.GN8119@techsingularity.net> Subject: Re: [PATCH] mm: Add WARN_ON for possibility of infinite loop if empty lists in free_pcppages_bulk' MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [10.65.193.88] X-Mailer: Zimbra 8.0.6_GA_5922 (ZimbraWebClient - FF48 (Linux)/8.0.6_GA_5922) Thread-Topic: Add WARN_ON for possibility of infinite loop if empty lists in free_pcppages_bulk' Thread-Index: QAvrc3cj1Bice5WQ6pNuBbku5mVJlA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > > > While debugging issue in realtime kernel i found a scenario > > > > which resulted in infinite loop resulting because of empty pcp->lists > > > > and valid 'to_free' value. This patch is to add 'WARN_ON' in function > > > > 'free_pcppages_bulk' if there is possibility of infinite loop because > > > > of any bug in code. > > > > > > > > > > What was the bug that allowed this situation to occur? It would imply > > > the pcp count was somehow out of sync. > > > > Yes pcp count was out of sync. It was a bug in the downstream code. > > If the bug is not in the mainline code, I think it would be inappropriate > to add unnecessary code to a relatively hot path. At most, it should be > a VM_BUG_ON but the soft lockup should be clear enough. yes 'VM_BUG_ON' is right thing here. This could help in realtime kernel where 'free_pcppages_bulk' is divided into two functions 'isolate_pcp_pages' and 'free_pcppages_bulk' where 'isolate_pcp_pages' isolate the 'batch/count' number of pages and 'free_pcppages_bulk' just free these pages. I was just thinking if there is any possibility of out of sync with count and temporary list this might help. But looking more at the code does not seems like there is any chance until any other potential bug somewhere else in code result this scenario. I will drop this patch. Thanks for the review. > > -- > Mel Gorman > SUSE Labs >