From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 860E1C4363A for ; Fri, 23 Oct 2020 16:48:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D4E74223EA for ; Fri, 23 Oct 2020 16:48:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="jdLCQf4t" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D4E74223EA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EB4186B0071; Fri, 23 Oct 2020 12:47:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E64CF6B0072; Fri, 23 Oct 2020 12:47:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D53226B0073; Fri, 23 Oct 2020 12:47:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0037.hostedemail.com [216.40.44.37]) by kanga.kvack.org (Postfix) with ESMTP id A6DB66B0071 for ; Fri, 23 Oct 2020 12:47:59 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 2965E8249980 for ; Fri, 23 Oct 2020 16:47:59 +0000 (UTC) X-FDA: 77403772278.11.hour00_221797e2725b Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id 02ADF180F8B86 for ; Fri, 23 Oct 2020 16:47:58 +0000 (UTC) X-HE-Tag: hour00_221797e2725b X-Filterd-Recvd-Size: 4907 Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) by imf11.hostedemail.com (Postfix) with ESMTP for ; Fri, 23 Oct 2020 16:47:58 +0000 (UTC) Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09NG8sWQ134654; Fri, 23 Oct 2020 16:47:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=aLaSUbNGPbiogDq5ld9W/E8GanyaJGz4nqeymdP61fY=; b=jdLCQf4tA0oQ2pi0gMvl5E80deVdLm5Yx2QnlCRdVJ85N6YboYPjsV+D73tvaQFnuKLy AXTg/APVOV2IwwxR3eP1iyCR4GWqUjTp9YrF8QMafDMayYhTUyb6hMHXLzsWOGjCVVs3 vxyAPfdjcy5Jf/fBlmV2WO7LtaiCAelz9FtL0ntf7HammIjdqO4hVf+JqUgbQOKLkR0p beiuHRlHXXJUsknimCKq+n69aFN503RfymbStxKBHxnP1zh6VZz6/F7kUmls46JpR2Es k3V2BhQcYHVQ7p46bM3u6L74xJzfPcLsNDrTPwYs4/xIBlqKeCJJsjpuHc5FPo6R3Zsc nw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 349jrq47uf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 23 Oct 2020 16:47:56 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 09NGA48S177948; Fri, 23 Oct 2020 16:47:55 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3020.oracle.com with ESMTP id 34ak1b8ga1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 23 Oct 2020 16:47:55 +0000 Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 09NGlrQx018594; Fri, 23 Oct 2020 16:47:53 GMT Received: from [192.168.2.112] (/50.38.35.18) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 23 Oct 2020 09:47:53 -0700 Subject: Re: [PATCH] hugetlb: fix locking in region_add,region_cgh,allocate_file_region_entries To: Oscar Salvador , Laurent Cremmer Cc: Andrew Morton , Mina Almasry , David Rientjes , linux-mm@kvack.org, Shuah Khan References: <20201023074759.46605-1-laurent@oss.volkswagen.com> <20201023110204.GA3925@linux> <20201023121129.GB3925@linux> From: Mike Kravetz Message-ID: Date: Fri, 23 Oct 2020 09:47:51 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20201023121129.GB3925@linux> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9782 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010230107 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9782 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 adultscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 spamscore=0 suspectscore=0 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010230107 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 10/23/20 5:11 AM, Oscar Salvador wrote: > On Fri, Oct 23, 2020 at 01:32:54PM +0200, Laurent Cremmer wrote: >> I came to the same conclusion with the help of David's remarks :-) . >> And in the end, this patch would be more about fixing the readability >> of the code than fixing a live problem per-se. If it ain't broken, >> don't fix it as they say :-) > > Yeah, definitely the code could benefit from a cleanup, so no one > has to stare at it for a while before he gets the idea. INDEED, those *region* routines dealing with reservation maps are difficult to understand, and could benefit from some cleanup. Recent changes to add support for reservation cgroup support made them even more complex. Laurent, thank you for taking the time to look into this. And thanks to Oscar and David for their analysis. The suggested patch would make the code more readable. However, that would be at the expense of another (and unnecessary) lock/unlock cycle. I'll add cleanup of these routines to my 'todo' list, but would be happy to work with anyone else who wants to take on this task. -- Mike Kravetz