Received: by 2002:ab2:23c8:0:b0:1f2:fdbc:cb93 with SMTP id a8csp30628lqe; Tue, 26 Mar 2024 19:11:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVEDW2y9cCabdM7lBOSIxe1dLA8bNvhvoCGfGAZUGhAOkOo4Su4hVDUyCzVZffsXj8WyQmHdh22Yo/OyLgllIYnFrFs6iiamXMA9q043g== X-Google-Smtp-Source: AGHT+IGln/NHzU7nS0IJf05un6AohmEPAduv2gGUb0I7JcTOD5bY3U6dZuJnzETrK6NEE9iZ1tvX X-Received: by 2002:a50:8e09:0:b0:56c:1bf7:1647 with SMTP id 9-20020a508e09000000b0056c1bf71647mr2015501edw.29.1711505490658; Tue, 26 Mar 2024 19:11:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711505490; cv=pass; d=google.com; s=arc-20160816; b=zgvTPLmxTlzuVhmcEOhEybqR/Vys3TVw2yWEFC+QxQZVaR2AbtPg9tQ3mPfkhQvuHv sjE1rdMsRyVtfVIV/+cZyzuh+4Zd6+VokBHCVFMw7CrQwqVj6lGQ6HorXM6cDLgLicEF Y+HvIStKYDeW1NcEbFgICTLsETXFYnfYcC3IAWTZgWkyU7c00QZQ45CziRID/WqcI/UH nKlQtlOpJ9qVM6DTcQhv3rBdhPojXYJtxEfm7PC9SXIoGgaee6V1rCD/uRPdPzgfUf3z lM3XjSSWE3sC74yB0qzLVs2ceMu1ZVp/WOVo9tUUBGuNqJHYvJRpVCqe4pItA7OQv1Lw KOCQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=VKgEZz3gqT/qrPZJxtA6ePPIz6oGvyMPjM3uA1fFlqE=; fh=tfuZkSsWttfxoy6nSK/63mnZhRe9rqX8vg10P6nnlZA=; b=IanmCqCVnw4o0xD0qLLbUp7CGibSLpS2BacfxwY1xWm8G4bW1vvEE3es+9Ts1ZkS12 8o7SWDtOocNlg3D3MqipaMduBrHYAQskfdDK3Qq4+6g0/Uuk31XEG4F+DS8Z/nH0I0n/ ezB0POEIOgQPv/MFoP+odmpP8Go5g962FXq8hr9TcsG2ewGXrn/ZItMpR83RFmn+Ak33 i9ZqIj4LIurULbpP0mYnICoyPka8rM+F+/gUcORbatCsmI4RfTve5FJBNNRYWkbRzDoy pc2j1AVKasFgtCq3/NrC8Dqy/8GSJ7v8VUfn+xCzvu1fnxmnZgYUOOBEVbZHWqBurpz5 9QBg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=JxRsfOQn; arc=pass (i=1 spf=pass spfdomain=bytedance.com dkim=pass dkdomain=bytedance.com dmarc=pass fromdomain=bytedance.com); spf=pass (google.com: domain of linux-kernel+bounces-120206-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-120206-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id i1-20020a05640242c100b005673b8a79c9si4383485edc.394.2024.03.26.19.11.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 19:11:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-120206-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=JxRsfOQn; arc=pass (i=1 spf=pass spfdomain=bytedance.com dkim=pass dkdomain=bytedance.com dmarc=pass fromdomain=bytedance.com); spf=pass (google.com: domain of linux-kernel+bounces-120206-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-120206-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3AA691F3EDBC for ; Wed, 27 Mar 2024 02:11:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D8F4E20334; Wed, 27 Mar 2024 02:11:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="JxRsfOQn" Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 39795219EB for ; Wed, 27 Mar 2024 02:11:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711505482; cv=none; b=MAaeqEyvfTXGXLgKyWjqe0V6nhlZmCJuZDY7H1uTpo3CZb4WtnC8AbsBW09ny1S92f2QqJkIUHEKrAVanWF8DcxL+pfZkpaktrWvUX4+/2a1t8rBlM12hstfzH9/m9xFbAkcLJooL5WLl/eWy+Rm0qjVIvqsR3Fa94PKXMkFDgY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711505482; c=relaxed/simple; bh=y2aifghtI/Ja4XD7u2NtI6N6MTi5BLIEicHNNSMA6SA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=tZLLOa+m2y2P3Senv1H/OzAglok8nNkmvb7OPviRXzNCevBZaR7+d0H99SMhkS6vi/UpNsiEpxl30Dymq/U+SI5f1plKgQrnbyhwGUbWCYUAgwcTKI6PWZ93umFbOlgXQCVtJBShkM/hrjU/2FHxCHrpTWeDSY464JR/d+FIFlE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=JxRsfOQn; arc=none smtp.client-ip=209.85.216.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Received: by mail-pj1-f42.google.com with SMTP id 98e67ed59e1d1-29f8403166aso1058048a91.1 for ; Tue, 26 Mar 2024 19:11:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1711505480; x=1712110280; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=VKgEZz3gqT/qrPZJxtA6ePPIz6oGvyMPjM3uA1fFlqE=; b=JxRsfOQn8gPSjir6TbrBjWXbK/PJp4ZBSwKtWzwl58PgosmH2htE9+JnrFwfbnzQ2G /qa55/418mac0pI1hfo5vRwTNvgu60YzGuXXTWbPdw4xSCbU9P28mRYteMbrcz9qhLMx fFGwlRPa9ESvMcE90yEh8E3G8fD3dm/8iyo6Cnmor6/SsdhSPMMVI0G/c080B2KXbSsJ 95pGqI7L+x9Fw3E6nJNoAc7GSEbX+N1sOw/7QDH9RCfJYh387NdNn+ocZ9vI757IaxX+ 3OQeXlXkwK+CZSWR1+VNrrJC4rkxeNAlNhGjmxE6yE4ylVRFrSEZiQfYLqdseXO/8ud7 F5Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711505480; x=1712110280; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VKgEZz3gqT/qrPZJxtA6ePPIz6oGvyMPjM3uA1fFlqE=; b=JaCIsiHHX0cDbO8oBD2ekWQNgGNACwPF/B1XOcEk5NKUV9I47ZOIf/dwwTHldg1+IT lYLmbg5Kcn4fMV5jwHwaml/4BOgMSQ+YjIFkAtwRx4OWQdLHKE4EpMduWqrxnzawL76v jXszv9e/ZLFaehTW7wVf6QgIUAWcn8YxYN/4htv0oHQ5DLxg45eIAdS+t2xWnlphd/nB k4zciJd7/BQnc1XBh7+iRVAcCjqq916wYNme59QMuOSWAufFc4BhrDac8Q+mmhCrGVD5 5x5uI4Qi8S3G07K7BaHACxLDrhfbY6DVxXc3hEtt/mGnnVhPto/u1o5OQGk35eL8vfjY ul8w== X-Forwarded-Encrypted: i=1; AJvYcCV1hQuPLotEgwm5TGdB78ua7LoK9TrQv20ojDaFU5eAUD+VdQb/OKO/1clta7gRnn0JUR+jVW1nf8p+TT5mF7Vj1uc24ZDBEa6LgfVC X-Gm-Message-State: AOJu0YzxIXzBhrem/1XVHClzgCN/uvN/mUg308FC1P1lWfnihcnY6gQC 28RVtyDouDfjbm74RMG1zeWJaTVRLmI0g1dvTYUobShp/4rio7xXOosnu74PSZQ= X-Received: by 2002:a17:90a:9f8b:b0:29b:fab2:8a24 with SMTP id o11-20020a17090a9f8b00b0029bfab28a24mr10290068pjp.3.1711505480542; Tue, 26 Mar 2024 19:11:20 -0700 (PDT) Received: from [10.254.105.249] ([139.177.225.230]) by smtp.gmail.com with ESMTPSA id q5-20020a17090ac10500b0029becfcb97esm335753pjt.22.2024.03.26.19.11.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 26 Mar 2024 19:11:20 -0700 (PDT) Message-ID: <7258d29d-0d4b-4463-8685-e3f21d426d2d@bytedance.com> Date: Wed, 27 Mar 2024 10:11:13 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 3/3] s390: supplement for ptdesc conversion Content-Language: en-US To: Vishal Moola Cc: akpm@linux-foundation.org, hughd@google.com, david@redhat.com, rppt@kernel.org, willy@infradead.org, muchun.song@linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christian Borntraeger , Janosch Frank , Claudio Imbrenda , kvm@vger.kernel.org, linux-s390@vger.kernel.org References: <04beaf3255056ffe131a5ea595736066c1e84756.1709541697.git.zhengqi.arch@bytedance.com> From: Qi Zheng In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024/3/27 03:48, Vishal Moola wrote: > On Mon, Mar 04, 2024 at 07:07:20PM +0800, Qi Zheng wrote: >> --- a/arch/s390/mm/gmap.c >> +++ b/arch/s390/mm/gmap.c >> @@ -206,9 +206,11 @@ static void gmap_free(struct gmap *gmap) >> >> /* Free additional data for a shadow gmap */ >> if (gmap_is_shadow(gmap)) { >> + struct ptdesc *ptdesc; >> + >> /* Free all page tables. */ >> - list_for_each_entry_safe(page, next, &gmap->pt_list, lru) >> - page_table_free_pgste(page); >> + list_for_each_entry_safe(ptdesc, next, &gmap->pt_list, pt_list) >> + page_table_free_pgste(ptdesc); > > An important note: ptdesc allocation/freeing is different than the > standard alloc_pages()/free_pages() routines architectures are used to. > Are we sure we don't have memory leaks here? > > We always allocate and free ptdescs as compound pages; for page table > struct pages, most archictectures do not. s390 has CRST_ALLOC_ORDER > pagetables, meaning if we free anything using the ptdesc api, we better > be sure it was allocated using the ptdesc api as well. According to the code inspection, all ptdescs added to the pmap->pt_list are allocated via page_table_alloc_pgste(). > > Like you, I don't have a s390 to test on, so hopefully some s390 expert > can chime in to let us know if we need a fix for this. Yes, hope so!