Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp67749rwj; Sat, 17 Dec 2022 04:25:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf6njWQDIG+XR5zgU2OQG6Z7oZbrZ1rReooqB8/fUW493X4lwrpSoKd2jC1BfhmlcmBwPnz1 X-Received: by 2002:a17:907:88cd:b0:7c1:932c:96d7 with SMTP id rq13-20020a17090788cd00b007c1932c96d7mr15625105ejc.58.1671279957672; Sat, 17 Dec 2022 04:25:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671279957; cv=none; d=google.com; s=arc-20160816; b=SQgp99ywwVlw2qUjbR4wI1l2qvuzm+EF2/xNw17R9+bvyAUks8J08PSp0dYviGMuj8 g0C+OJVatJJ67O1nwGn5UHBk5WikRq4ZXYOxBgpT6qMcSr8EU5DcQBRlrevFguRuN3f4 0UnWTkCw/QS6DnKW/M3xHKSMEx3F5QbF8K8imHgYZGdQ708hFSfsXerR3UsL1KoVw8Ft 1kvMedHGJZJCmVb9Th5GEMbP0pOeXd6iVQ808ar8FF0nWlATm92nSk/Y/u+JKuGhCeTx wx5t2IhmWB3JRnSTT0V66vD+zx2NkxEVKy76rs4V6xuQ42Agj2to3Sb65/UfnH+NvKR/ VvoQ== 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:dkim-signature; bh=GBSVB2Oi5TbTIwwaOpRKfNJzplXssZ9oR2ZKAZimo4E=; b=oHudHWtNWp2Ycu1Bghi6MX8YoYSSwy9i73aajh4wRjPTpB5g8b7nnkpQGjaxRpWB7M w5/u1r+FcfnrU7MimtGTjv4gP0wHRVGrYPBxj8EBBq7Wp1b8VxTbhvooota6P++BwBjW 5noAHQexbxmSEYU8EQ8uLdxVg9vLHgRYReXJ8lAb7bu/+XCzkgPZezjeYgTjlHJZWBQE F6mO7boDb0TAWfKuQ2cWyzhMMXO+EZRg3jL2kthqw3RrnXo/ylbP3T0DHxua/FeE3lsb 3yARFlSUQ1m8RqUZ4KgGUAa3GRll1cSWL2trfoBYzZmXkmaIfcyFtTHF1gVZAsHXWOvu v06w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=k0fpKgaZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i18-20020a1709064fd200b007bedd130080si5202738ejw.231.2022.12.17.04.25.40; Sat, 17 Dec 2022 04:25:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=k0fpKgaZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230123AbiLQLod (ORCPT + 69 others); Sat, 17 Dec 2022 06:44:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230105AbiLQLo0 (ORCPT ); Sat, 17 Dec 2022 06:44:26 -0500 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65A6013EAD for ; Sat, 17 Dec 2022 03:44:25 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id bg10so3475526wmb.1 for ; Sat, 17 Dec 2022 03:44:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=GBSVB2Oi5TbTIwwaOpRKfNJzplXssZ9oR2ZKAZimo4E=; b=k0fpKgaZIUGDT6X0DZ06jlzs25bISKhHU8bB9iJXybs6SUxcmHz9r0S8xiebXfjzX8 THW+vbhhcdK+2AP0ygoxLy2aURFM1ZisP7eBv1m0Y1yBXewI5nBtOl+ZZ3jOn+lBcoTr T4jbe7AmYMuKIgpOr2CCC7SsOZMuIbfKb52WMBhhAxowekO3hr9891cassApDuvzcSYV NfOWeLj2rP1/jdtA1r6KV9xpZmrQW3OBh4AT1J8oMES7ixoKtzYbANxIlTaYyYyQM3Mm npGVkj3MjY/3JPn/uDpJJNcLMuoSN+UR1B3jVLSvmYo2UqF30KFUzfh7M5c+5EVTv6Zc 1d4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=GBSVB2Oi5TbTIwwaOpRKfNJzplXssZ9oR2ZKAZimo4E=; b=mbe3h3CmkBpL3aIgAz6EI0T7Gi/wr7otr+dNpwivDoasrUGWBLLGPLSrwzbnt2T7C4 k6PSHSgsN699Vu8jcrW/31NgQGKwaDZxebyd1I/PAJxVkWG7ZCQ6x5d+jk/C566IuaYE atz/dmovx+Hi29UdI6Se/rnEFg/KM7jRZ1w/SKcNQTuNWbc5rYrba3x+TaUm516f6/WD OI8ALT5cDOaenJtOkqH+5cd4QYk3AOJ8BA7YHVFQWr5p+YNnz7HJoiCr7cTJH5plPNMZ 4sOM1zDaelsuUPnAXriO4ZJk2IbBFlisO2PC6ZUDLf4jfgwsotjiXnOcfEa/g4nRvEys Pr+w== X-Gm-Message-State: AFqh2krLI2SzyrdOO8naALlEu9cb6SYSjWwS2jb3vJtdq5wjQ/Tohq3J wcFEi2iJ5jUNrTZFatZ5b/M= X-Received: by 2002:a05:600c:210f:b0:3d3:4406:8a3c with SMTP id u15-20020a05600c210f00b003d344068a3cmr4380165wml.32.1671277463842; Sat, 17 Dec 2022 03:44:23 -0800 (PST) Received: from localhost ([2a00:23c5:dc8c:8701:1663:9a35:5a7b:1d76]) by smtp.gmail.com with ESMTPSA id 8-20020a05600c020800b003b4935f04a4sm6505486wmi.5.2022.12.17.03.44.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Dec 2022 03:44:23 -0800 (PST) Date: Sat, 17 Dec 2022 11:44:22 +0000 From: Lorenzo Stoakes To: Baoquan He Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, urezki@gmail.com, stephen.s.brennan@oracle.com, willy@infradead.org, akpm@linux-foundation.org, hch@infradead.org Subject: Re: [PATCH v2 2/7] mm/vmalloc.c: add flags to mark vm_map_ram area Message-ID: References: <20221217015435.73889-1-bhe@redhat.com> <20221217015435.73889-3-bhe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221217015435.73889-3-bhe@redhat.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Dec 17, 2022 at 09:54:30AM +0800, Baoquan He wrote: > @@ -2229,8 +2236,12 @@ void vm_unmap_ram(const void *mem, unsigned int count) > return; > } > > - va = find_vmap_area(addr); > + spin_lock(&vmap_area_lock); > + va = __find_vmap_area((unsigned long)addr, &vmap_area_root); > BUG_ON(!va); > + if (va) > + va->flags &= ~VMAP_RAM; > + spin_unlock(&vmap_area_lock); > debug_check_no_locks_freed((void *)va->va_start, > (va->va_end - va->va_start)); > free_unmap_vmap_area(va); Would it be better to perform the BUG_ON() after the lock is released? You already check if va exists before unmasking so it's safe. Also, do we want to clear VMAP_BLOCK here?