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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 493F7C3DA49 for ; Thu, 18 Jul 2024 09:19:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D2B926B0089; Thu, 18 Jul 2024 05:19:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CDB6F6B008C; Thu, 18 Jul 2024 05:19:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B7C9D6B0092; Thu, 18 Jul 2024 05:19:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 9460B6B0089 for ; Thu, 18 Jul 2024 05:19:58 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 88A81A05CD for ; Thu, 18 Jul 2024 09:19:57 +0000 (UTC) X-FDA: 82352326434.29.8557D76 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf01.hostedemail.com (Postfix) with ESMTP id 1B88A40024 for ; Thu, 18 Jul 2024 09:19:54 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=LzdAj7PB; spf=pass (imf01.hostedemail.com: domain of vbabka@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=vbabka@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721294364; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=mqsXPrFCZAhLxX2BsIasz+HoJ4h9tmYrLtIXotjmHqY=; b=C0Ehbdk4OpZnHIltW2XxpI//zH5LC77WsZBPgCSRa+P/uhUPYOJzgrww9h56gpoW+f7cnO Vuv0Ho6auco0wPxHVgO3q/FdWMrJ3yWPvbt4lFjxl3o3EtW4O/j7nkDbFlVyvwFUhIj692 LKbror3l/oxYvMXHkfKtIZPF0ciNnMw= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=LzdAj7PB; spf=pass (imf01.hostedemail.com: domain of vbabka@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=vbabka@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721294364; a=rsa-sha256; cv=none; b=hO66/q5NvVDACbW3EfTKu+IIjerNMg6uQKSiH3VLLwCvhi+lEyLtvnVYpnDouocREWF3yI rxNLU6pOsn9gso3w9CbyVoVnOXaGoQ2s2nkHjZSa+9AVhXxjXOPI44gPP2VUm9sAW7rHo4 B6eSNjpSVDOsr9kEf6HxX3spuDN5oE0= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id C48BDCE062B; Thu, 18 Jul 2024 09:19:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A71E6C116B1; Thu, 18 Jul 2024 09:19:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721294391; bh=JHPP4Mp0x8FuvmMJ+shD192GYO/rYQu/8eEDu1L9I1E=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=LzdAj7PBpfaUWnjrKQvjbs5b6Ko64yKMlkZfPMpy3Kyk+27Tn8OtyokBYQmg3zA57 qEeaZi7kgRVZkFerLWxaQI1FI6TRaM+0WNx/v1wIKybd913OIhZmMSnM342TcCkRaT bRwB/L3i4ymQKUsrjqks+1mkZbVW6dGkh4bAhcDae3PiKb/BnU/EBNI1tGMi6Jhqeb waaGnaAgXsV4SJRURc7sRsPiYeJYHst8f3kjmCLT5w/rkpAFWrytjuwkFz/lgFqcU1 cUWSehAFjaAyzag9/ZiP6gkSNyWzi/U/pYe17ipi/YX8OusKZEA+Q+RBrLh8R9yNkU 1l8IytZxncCdA== Message-ID: <6b193cd1-ee30-4fd8-a748-ed266fe4bc37@kernel.org> Date: Thu, 18 Jul 2024 11:19:46 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 0/2] mm: skip memcg for certain address space Content-Language: en-US To: Qu Wenruo , Qu Wenruo , Michal Hocko Cc: linux-btrfs@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Johannes Weiner , Roman Gushchin , Shakeel Butt , Muchun Song , Cgroups , Matthew Wilcox References: <8faa191c-a216-4da0-a92c-2456521dcf08@kernel.org> <9c0d7ce7-b17d-4d41-b98a-c50fd0c2c562@gmx.com> <9572fc2b-12b0-41a3-82dc-bb273bfdd51d@kernel.org> <3cc3e652-e058-4995-8347-337ae605ebab@suse.com> <2b48a095-97e6-43bc-9f7c-13dd31ce00b8@suse.com> From: "Vlastimil Babka (SUSE)" In-Reply-To: <2b48a095-97e6-43bc-9f7c-13dd31ce00b8@suse.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Stat-Signature: pindwmu5orscdwk95bkwm3ipofhdj7o1 X-Rspam-User: X-Rspamd-Queue-Id: 1B88A40024 X-Rspamd-Server: rspam02 X-HE-Tag: 1721294394-134400 X-HE-Meta: U2FsdGVkX19sBXWzxLvu0388teuFkXtpLO6VM9E1bBqXg5wE/hnO3ADpTYIG7zy0XgL5I3/5ne/+bmi9KQHwL1ytDwUz0qo27qL/rEBR1DRNm4y/jZ7KycRZFYZqx/8AR+1Y12pH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ERa+N3PbiaMXoKnQs3m4+w== 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: List-Subscribe: List-Unsubscribe: On 7/18/24 10:50 AM, Qu Wenruo wrote: > > > 在 2024/7/18 17:58, Vlastimil Babka (SUSE) 写道: >> On 7/18/24 9:52 AM, Qu Wenruo wrote: >>> >>> The previous rc kernel. IIRC it's v6.10-rc6. >>> >>> But that needs extra btrfs patches, or btrfs are still only doing the >>> order-0 allocation, then add the order-0 folio into the filemap. >>> >>> The extra patch just direct btrfs to allocate an order 2 folio (matching >>> the default 16K nodesize), then attach the folio to the metadata filemap. >>> >>> With extra coding handling corner cases like different folio sizes etc. >> >> Hm right, but the same code is triggered for high-order folios (at least for >> user mappable page cache) today by some filesystems AFAIK, so we should be >> seeing such lockups already? btrfs case might be special that it's for the >> internal node as you explain, but that makes no difference for >> filemap_add_folio(), right? Or is it the only user with GFP_NOFS? Also is >> that passed as gfp directly or are there some extra scoped gfp resctrictions >> involved? (memalloc_..._save()). > > I'm not sure about other fses, but for that hang case, it's very > metadata heavy, and ALL folios for that btree inode filemap is in order > 2, since we're always allocating the order folios using GFP_NOFAIL, and > attaching that folio into the filemap using GFP_NOFAIL too. > > Not sure if other fses can have such situation. Doh right of course, the __GFP_NOFAIL is the special part compared to the usual page cache usage. > [...] >>> If I understand it correctly, we have implemented release_folio() >>> callback, which does the btrfs metadata checks to determine if we can >>> release the current folio, and avoid releasing folios that's still under >>> IO etc. >> >> I see, thanks. Sounds like there might be potentially some suboptimal >> handling in that the folio will appear inactive because there's no >> references that folio_check_references() can detect, unless there's some >> folio_mark_accessed() calls involved (I see some FGP_ACCESSED in btrfs so >> maybe that's fine enough) so reclaim could consider it often, only to be >> stopped by release_folio failing. > > For the page accessed part, btrfs handles it by > mark_extent_buffer_accessed() call, and it's called every time we try to > grab an extent buffer structure (the structure used to represent a > metadata block inside btrfs). > > So the accessed flag part should be fine I guess? Sounds good then, thanks! > Thanks, > Qu >> >>>> >>>> (sorry if the questions seem noob, I'm not that much familiar with the page >>>> cache side of mm) >>> >>> No worry at all, I'm also a newbie on the whole mm part. >>> >>> Thanks, >>> Qu >>> >>>> >>>>> Thanks, >>>>> Qu >>>> >>