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 756ADC77B75 for ; Wed, 17 May 2023 11:33:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E2B6E900004; Wed, 17 May 2023 07:33:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DB58B900003; Wed, 17 May 2023 07:33:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C2DF4900004; Wed, 17 May 2023 07:33:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id AC97D900003 for ; Wed, 17 May 2023 07:33:06 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 6846A1A0534 for ; Wed, 17 May 2023 11:33:06 +0000 (UTC) X-FDA: 80799535572.17.4DB89F7 Received: from mail-yw1-f177.google.com (mail-yw1-f177.google.com [209.85.128.177]) by imf23.hostedemail.com (Postfix) with ESMTP id 9350A140018 for ; Wed, 17 May 2023 11:33:04 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=N2DxmYlr; spf=pass (imf23.hostedemail.com: domain of hughd@google.com designates 209.85.128.177 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684323184; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=HvwENPq8tz9NntrqfQSfZoeD7LfbRJhmcL0T3gzk8cQ=; b=tlQ/BW2XAjGNJ35q3eYD1W4aW+6E4n94uveuyuKCpxBsfF8GB5OO7HybrU+5EFUblyA4n5 lXn+nS+ZKeJCz15mEnhgQra9pUXkDZ1LumvOjl/rUgqZYMkwxQ65lfukGzbeVyVMu9KhHJ CirrOcC7NCcVWdMy/OgWL4+MmWsHGg8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684323184; a=rsa-sha256; cv=none; b=hd3Pl2iAHp1TxkpnHJiFV7K1OdAmWS7m44sxO9f/+BZGdBmzCFsClhYgckEHrA+gCkuWPA rEJ87TDHfuJkIxaq4HcqYQLzhyNEyNrw0QX1FvWDVmeBxwAg2/kj0FjtfCCrmGXJG8QfOt hf2AZ7p4lsxcsghZeZXYmq7q9fNAftI= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=N2DxmYlr; spf=pass (imf23.hostedemail.com: domain of hughd@google.com designates 209.85.128.177 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yw1-f177.google.com with SMTP id 00721157ae682-55a2cb9788dso6479067b3.2 for ; Wed, 17 May 2023 04:33:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1684323183; x=1686915183; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=HvwENPq8tz9NntrqfQSfZoeD7LfbRJhmcL0T3gzk8cQ=; b=N2DxmYlr27xb0YitGC/hgEDkTgMt7b1iKxAHC68gdSzL+L0v1G35idBVkCx6Ybj8W6 YsyR4O5U8mzovWTQWLq9K8q5W7NFgg7GUl5wzSCxsiUyip8nBe4tUmBhMRnFbe6ldOZB f0Mg5faItUv/poG4hvzPUzKZPe/Ox/0uGUty/0pYiZSYTN0pdzIWgnzKLo2ADFGAPzB2 V5L7ovVNnhItXHGFqjn1wCvBlsxTfBs8AlbxNAXY7yOAKRnVACWuIicPwt0p7wRkwL/Y zWW41o4E9Ulolm/FBenBlsL6vyJtF9wEAUPPnZfM9UYt4Yc+L6cf5mSC8yofzX/xByUG PT3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684323183; x=1686915183; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=HvwENPq8tz9NntrqfQSfZoeD7LfbRJhmcL0T3gzk8cQ=; b=WB2AKubHILG5B+imgLf2Tb8dzvmbOXOd/12AJt8Aa0r7qk8NkRwM0L41YOtWZWUsx4 XR/30g8SMXG5iCOku9NyPvw9WGDzEaIEivwl+4YtHkJBnEGUg/oGRj8HGrsE+X3uUuhQ cIdzLFXJVnIGSKlO7DjKNiEEtOl1FRW9yWRhwOfzrT8gCNXWRW1aSerDZt+V1/71F2Zs RpeqOSZcwq5+4fYOUa4CaFGyxKchmOmXh8jbWU/To3eepmoSpo3cl0JkQBmVAXFMPc9d zWjFHKjGDn+xyn+mcC0uaLY2whUdUvajBZIA03lY/fa4blumN7AIs7H/EhvnV5XJgHWm i4sw== X-Gm-Message-State: AC+VfDwcT0buo8PaOCW4GD1d9mSCxSjBO2E/Ar0F0/XHyojwpMG3n1xM nFzy2BYe7BdmhL7KN26o5yqTmg== X-Google-Smtp-Source: ACHHUZ7QI6oEtWWpej1fkbLVHNVY3j0sKPynjITx+DFobNdeMqR68LNW0+OB/2tJfik76Ijyk66Giw== X-Received: by 2002:a0d:e255:0:b0:561:904d:27d9 with SMTP id l82-20020a0de255000000b00561904d27d9mr4059441ywe.4.1684323183452; Wed, 17 May 2023 04:33:03 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id k1-20020a819301000000b005617251bb95sm593292ywg.84.2023.05.17.04.33.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 May 2023 04:33:03 -0700 (PDT) Date: Wed, 17 May 2023 04:32:50 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Charan Teja Kalla cc: Hugh Dickins , akpm@linux-foundation.org, willy@infradead.org, markhemm@googlemail.com, rientjes@google.com, surenb@google.com, shakeelb@google.com, fvdl@google.com, quic_pkondeti@quicinc.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V7 2/2] mm: shmem: implement POSIX_FADV_[WILL|DONT]NEED for shmem In-Reply-To: Message-ID: References: <631e42b6dffdcc4b4b24f5be715c37f78bf903db.1676378702.git.quic_charante@quicinc.com> <2d56e1dd-68b5-c99e-522f-f8dadf6ad69e@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Stat-Signature: watpk7he91e437at1dz3b8wm174ffkwg X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 9350A140018 X-HE-Tag: 1684323184-563883 X-HE-Meta: U2FsdGVkX19M/inmL4feZyV+mFi5V3xMzr9ZawPSqIF6VTW6MnZbIJQUZMskGw/srQ5CxktDa89LJepE7pmWQkjv3oaJRX/zz00jB5KFNCVzpUZUxLc+8Pt6CNEm/eScvrnOHy8Rk+g1YRcrOlLtJLqxEoA7aSZmGGq+IG81u/VjNscSChq2BaEFTtAjC+lQbD4tHTjDiEoFEjzi92FR0p3DCPjN37ru88SCWW8VOdq0BIIOPG8hb5SShPWUJ6VspMUDjZ/SW/PTN24r+ccYhq++PHY1eE52qwnhCsqYD6kZ5+Fmhyhu/5deTXANn/eQM0pYXo2khBGVHkeQNzTDLlk3mZiYZa9oo2fS5kTxsX13wGJPuTxhI2coZ+h1cQApamvgR+BNO6Es/5PI7IhMKnSkjnx1j7NDtax33A43o8oRJlptwud0Mkv+xFPXhv3QkTTWSp083Zt65Uv/7CrfCGKyWmBOOEX/L6Ek4EdRq72bD3VWu4xuXHCsPv5A0yZ6jVb7cne8Tj6aByGW9Rg4dGukPh2bwveU/oz5btgIMP4RWD+bbTPp+4/PYV6deVy2f88kzdEQ6jqKUix7mNlvIeSgurvHghQPVozCz1u8g+ZWHRsFN+xJaP+3SaU21OdPL6Lgo96OE2snbYViUcXpRx0zAyO1Dwi2oOaXVGBxw4vW43ryCM4iBUHwxe9Li1X0e6Tic/8hj8aN6MEk5hYDrUzTrBGmf/oqM7qdnJSTS81pl4AO0Cr6RWda3Eoju6KNV9Vuu3Z4S9HkN1+yr3zLgKlNznmC9oGHcwzlvvAxwlJWCkMc/IEIpL6z8uwmbNnh+hNKMvxqzAfa2pr8uvf5yDMv6wDZMkvIj2RjAPu1LmNtlvQUfZKXXtlyDiu1J5OFsNXJ0xKJEFqID2XD8/m03Ndak6+mDdpnPq/aGX7QTgesE7lBT+KbRunbGW6nb0quhxyAb1SzqfBlArTF0ZT 2PtiKuAJ S5peanQkL/3d6sb2oqoGM0TMFqgeb60P+sukNiC8Xbm/nJ2o2ARehq8r+WpZXPjlOzEj1Du8nHqrcWobO3aBOigXHwNX4elaeByytkDG78MEkIg/AO4/xw/2UnAGIa283EFoWSSGzPp222A9Td3+8C5LQPattbEu7XpeEjKFxv2wgFRNu5+H4Kzvx+0oqpLAhXSQckGPEA0d20rAeQQdKTOaVOXxiOwN7BiOlYQoQWQC4HIX7rBn8iOxWbw07fBrlLSMq/fh39ZcL1K3m37UYXRzkP6dyZZ8khSJ4oQJMq3VlQzs9MQXCHD7EvJon5I0LYhTFYf3SkAC316su7P++v/nxZFKv2NbCU3XXY4a7XsaTGQGx1jbbcV1hKHMz0jw6WcGHrLOTl6Gr11xMYdyqwsn41YK3d4i6wxbx X-Bogosity: Ham, tests=bogofilter, spamicity=0.221933, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, 24 Apr 2023, Charan Teja Kalla wrote: > On 4/21/2023 5:37 AM, Hugh Dickins wrote: > > This is where I ran out of time. I'm afraid all the focus on > > fadvise_calc_endbyte() has distracted you from looking at the DONTNEED > > in mm/fadvise.c: where there are detailed comments on why and how it > > then narrows the DONTNEED range. And aside from needing to duplicate > > that here for shmem (or put it into another or combined helper), it > > implies to me that shmem_isolate_pages_range() needs to do a similar > > narrowing, when it finds that the range overlaps part of a large folio. > > > Sure, will include those range calculations for shmem pages too. Oh, I forgot this issue, you would have liked me to look at V8 by now, to see whether I agree with your resolution there. Sorry, no, I've not been able to divert my concentration to it yet. And it's quite likely that I shall disagree, because I've a history of disagreeing even with myself on such range widening/narrowing issues - reconciling conflicting precedents is difficult :( > > > Something that has crossed my mind as a worry, but I've not had time > > to look further into (maybe it's no concern at all) is the question > > of this syscall temporarily isolating a very large number of folios, > > whether they need to be (or perhaps already are) counted in > > NR_ISOLATED_ANON, whether too many isolated needs to be limited. > > They are _not_ counted as ISOLATED_ANON now as this operation is for a > small duration. I do see there exists too_many_isolated() checks in > direct reclaim/compaction logic where it is necessary to stop the > multiple processes in the direct reclaim from isolating too many pages. > > I am not able to envisage such problem here, where usually single > process doing the fadvise operation on a file. Even If the file is > opened by multiple processes and do fadvise, the operation is limited > only to the pages of this file and doesn't impact the system. > > Please let me know if I'm missing something where I should be counting > these as NR_ISOLATED. Please grep for NR_ISOLATED, to see where and how they get manipulated already, and follow the existing examples. The case that sticks in my mind is in mm/mempolicy.c, where the migrate_pages() syscall can build up a gigantic quantity of transiently isolated pages: your syscall can do the same, so should account for itself in the same way. I'm not claiming that mm/vmscan.c's too_many_isolated(), and the way it gets used by shrink_inactive_list(), is perfect: not at all. But please follow existing convention. Sorry, that's all for now. Hugh