Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp3487040pxb; Wed, 14 Apr 2021 06:41:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3mqYyk1A80sY77sz/3Yek5T+mrTfNJYv/+RcxspZl07I6miZWgUJ+QCrSQisk2bHoSycR X-Received: by 2002:aa7:cb97:: with SMTP id r23mr40446441edt.106.1618407683283; Wed, 14 Apr 2021 06:41:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618407683; cv=none; d=google.com; s=arc-20160816; b=aHe1dZ2VnSj/kEDZ6S2LYWvoVnGdtomrPU9a2FVJcs6nCWTmNXY8kCEpKmWPOVCrD9 AB7YRe90cYWHoKEJE8y2EAG7J/r4f1rsQ+s/B3LulueyAKidcu/oORD0W6Tw0YMrSdEx g9Zd0Z/80AoZImUAGZGCrdmgWJb83OLWSmVANkv28xR8x3IiYwnMlluouXYsM61JM5X/ Ag/JIzP+Z4ditmen7wdZ2+tdvJn+1IoqWLpJqze7dq0tERScselVtQ8Pbo4qi7q5VLVv ml+DBoPu2QriihZU9R6aEzf3Brnks5NBgR8imKnijeem/XqzIYGyt0UzxkHrwo0KVWHz psPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=50N2sJmGSjnJvoJue+I/yvCgUQOc3DUHiJAqsJwfX30=; b=yJtMLw5srJzJ1RO2GyFBZgs7SSSUGEh5aA7pd8gbYCrAlWC7BSC6+0JHlv9tS+HCg8 gnwQEsCYXDXjCzvf5MUvCxXeCUn+eNF7icAK6s8Etqyrvona1PtxhSSI+XcDEqCp6G66 cdZhgoZL5S1wiSOgCClUcgyrRKBU/lyUA5Ge0Q0k4Gdnn2PWBIzvIlIUXVF65sgpwBUU LJLrOc31r0grFHM/VIeTS2X49OVVHcq1VMSg8EkWLPv500F6aHVw6cpPHAuw7rOBXkZ8 DX9BN5PmJmFLfKgmiYdHLhiTk9Z4nltX7DJr01ywFeJGkAhQN7RBe8uM5OcKupiL15SH JB5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lh4si11959712ejb.652.2021.04.14.06.40.56; Wed, 14 Apr 2021 06:41:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345856AbhDNEwp (ORCPT + 99 others); Wed, 14 Apr 2021 00:52:45 -0400 Received: from mx2.suse.de ([195.135.220.15]:54262 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230249AbhDNEwo (ORCPT ); Wed, 14 Apr 2021 00:52:44 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 606BDB01D; Wed, 14 Apr 2021 04:52:22 +0000 (UTC) Date: Wed, 14 Apr 2021 06:52:19 +0200 From: Oscar Salvador To: Mike Kravetz Cc: Andrew Morton , Vlastimil Babka , David Hildenbrand , Michal Hocko , Muchun Song , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v7 6/7] mm: Make alloc_contig_range handle in-use hugetlb pages Message-ID: References: <20210413104747.12177-1-osalvador@suse.de> <20210413104747.12177-7-osalvador@suse.de> <722f9a5e-ef0a-508a-e58a-6c3eacb5d1bd@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <722f9a5e-ef0a-508a-e58a-6c3eacb5d1bd@oracle.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 13, 2021 at 03:48:53PM -0700, Mike Kravetz wrote: > The label free_new is: > > free_new: > spin_unlock_irq(&hugetlb_lock); > __free_pages(new_page, huge_page_order(h)); > > return ret; > > So, we are locking and immediately unlocking without any code in > between. Usually, I don't like like multiple labels before return. > However, perhaps we should add another to avoid this unnecessary > cycle. On the other hand, this is an uncommon race condition so the > simple code may be acceptable. I guess we could have something like: free_new: spin_unlock_irq(&hugetlb_lock); free_new_nolock: __free_pages(new_page, huge_page_order(h)); return ret; And let the retry go to there without locking. But as you said, the racecondition is rare enough, so I am not sure if this buys us much. But I can certainly add it if you feel strong about it. -- Oscar Salvador SUSE L3