From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A5B867F7F9 for ; Mon, 26 Feb 2024 13:04:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708952658; cv=none; b=ZIFtibPnpyb0L8QqD5tEQTaG32XlozMJ0eotgvOsJW029jKGiq6RBWxZl8GGTr8xpDv3QCxsyMSxkBUoiJK36KIN0OWWiu5/P0rSfUnT8wfNGvUYktHWEt9Jp9KBLSMZ/plzEXo8VSVJyZra15qEu8xXkxA/bpw2CC2PVadfiKU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708952658; c=relaxed/simple; bh=NLg6QYanoeqzWqGaHoMhjzpszT/KgDkGZ09M4+9jIsk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=X8XSfCA9A4VP239N8uCUh+j/TIZSz17jWmxbgTqZ0O0b6jNGKSG7zHzIpmMgHm/CDrzbQAtM3BojnGO7Ll4Lnbjt1EHAwlQAunvj0zDClSww+uzK1MoxxUz9guJpQ8UlNr5OO2e4APVw1lA2iZCze4gqpEI18zZiHE5iLmwI4u0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 70626DA7; Mon, 26 Feb 2024 05:04:54 -0800 (PST) Received: from [10.57.67.4] (unknown [10.57.67.4]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 291613F762; Mon, 26 Feb 2024 05:04:13 -0800 (PST) Message-ID: <318be511-06de-423e-8216-af869f27f849@arm.com> Date: Mon, 26 Feb 2024 13:04:11 +0000 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 1/1] mm/madvise: enhance lazyfreeing with mTHP in madvise_free Content-Language: en-GB To: Lance Yang , David Hildenbrand Cc: 21cnbao@gmail.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, mhocko@suse.com, minchan@kernel.org, peterx@redhat.com, shy828301@gmail.com, songmuchun@bytedance.com, wangkefeng.wang@huawei.com, zokeefe@google.com, fengwei.yin@intel.com References: <20240226083714.26187-1-ioworker0@gmail.com> <9bcf5141-7376-441e-bbe3-779956ef28b9@redhat.com> From: Ryan Roberts In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 26/02/2024 08:55, Lance Yang wrote: > Hey David, > > Thanks for your suggestion! > > On Mon, Feb 26, 2024 at 4:41 PM David Hildenbrand wrote: >> > [...] >>> On Mon, Feb 26, 2024 at 12:00 PM Barry Song <21cnbao@gmail.com> wrote: >>> [...] >>>> On Mon, Feb 26, 2024 at 1:33 AM Lance Yang wrote: >>> [...] > [...] >>> +static inline bool pte_range_cont_mapped(pte_t *pte, unsigned long nr) >>> +{ >>> + pte_t pte_val; >>> + unsigned long pfn = pte_pfn(pte); >>> + for (int i = 0; i < nr; i++) { >>> + pte_val = ptep_get(pte + i); >>> + if (pte_none(pte_val) || pte_pfn(pte_val) != (pfn + i)) >>> + return false; >>> + } >>> + return true; >>> +} >> >> I dislike the "cont mapped" terminology. >> >> Maybe folio_pte_batch() does what you want? > > folio_pte_batch() is a good choice. Appreciate it! Agreed, folio_pte_batch() is likely to be widely useful for this change and others, so suggest exporting it from memory.c and reusing as is if possible. > > Best, > Lance > >> >> -- >> Cheers, >> >> David / dhildenb >>