Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756076Ab3GVOzn (ORCPT ); Mon, 22 Jul 2013 10:55:43 -0400 Received: from cantor2.suse.de ([195.135.220.15]:56334 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755767Ab3GVOzm (ORCPT ); Mon, 22 Jul 2013 10:55:42 -0400 Date: Mon, 22 Jul 2013 16:55:41 +0200 From: Michal Hocko To: Joonsoo Kim Cc: Andrew Morton , Rik van Riel , Mel Gorman , "Aneesh Kumar K.V" , KAMEZAWA Hiroyuki , Hugh Dickins , Davidlohr Bueso , David Gibson , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Joonsoo Kim Subject: Re: [PATCH 5/9] mm, hugetlb: remove redundant list_empty check in gather_surplus_pages() Message-ID: <20130722145541.GG24400@dhcp22.suse.cz> References: <1373881967-16153-1-git-send-email-iamjoonsoo.kim@lge.com> <1373881967-16153-6-git-send-email-iamjoonsoo.kim@lge.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1373881967-16153-6-git-send-email-iamjoonsoo.kim@lge.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1050 Lines: 38 On Mon 15-07-13 18:52:43, Joonsoo Kim wrote: > If list is empty, list_for_each_entry_safe() doesn't do anything. > So, this check is redundant. Remove it. > > Signed-off-by: Joonsoo Kim Acked-by: Michal Hocko > > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > index a838e6b..d4a1695 100644 > --- a/mm/hugetlb.c > +++ b/mm/hugetlb.c > @@ -1019,10 +1019,8 @@ free: > spin_unlock(&hugetlb_lock); > > /* Free unnecessary surplus pages to the buddy allocator */ > - if (!list_empty(&surplus_list)) { > - list_for_each_entry_safe(page, tmp, &surplus_list, lru) { > - put_page(page); > - } > + list_for_each_entry_safe(page, tmp, &surplus_list, lru) { > + put_page(page); > } > spin_lock(&hugetlb_lock); > > -- > 1.7.9.5 > -- Michal Hocko SUSE Labs -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/