Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp32851488rwd; Fri, 7 Jul 2023 23:50:37 -0700 (PDT) X-Google-Smtp-Source: APBJJlGGsBNppnrnMhFl9j2Z15FIfqr6v0RYhSSz7/POm7Ejhhtx6O6lfwvg+cPdBSWQHlItWmrT X-Received: by 2002:aa7:85d2:0:b0:666:6c01:2e9e with SMTP id z18-20020aa785d2000000b006666c012e9emr13322855pfn.15.1688799037020; Fri, 07 Jul 2023 23:50:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688799037; cv=none; d=google.com; s=arc-20160816; b=nVVo5a9cIySqZcMxXV/pFef4X3NA7uiRcNRjwXgPEfXxxLk91EcHnMFT1vh6sBHLf3 B68II6EZgvoLge75poyFz0jeXFhmh4eLOplE7ioRu4QqjOgadXnhkFsf+8sPBfuZpu4g 3JCXuKboa8vGUw8z3KTX2uq+VURIcp/tGq2OumMJEvZaqdAyaN9xei2xZ/zBTunh7NCX /ARQBMvJHC6fE0BC8p+evZXSiRpFxjEf3xUJfV5MqfHseuyIyl7p4qvmIT+0HwubKGH8 GGjnjRn1q2ZHF5g+dk0KgvcG0wQYZtaVSSyQmwjgSkLJCjrLig8bG96fL8xzh2EC+RcC 7BZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=mn+nUOxWSZTxZ7OcyeEWmpBqaocgMenrl66gbGB3Jrs=; fh=fM/EfF4fNCzf+/RTTj0QfYV1ZbEhYIADRY1u/mFnwuU=; b=P2IS92hJmvz0aXFsMJvMwA82Upf+B6VQze6gu3Ub7+y2xO9ovpI4TUvj669uVZXJgV 2f+p7DZ/Hzk5jW8kEBAGYpwOqN1dXCUYxzBrqOE3ZNXNK5w+j7Y8RYXCicPNAMexQOAI /5YAdGiIqWHeOQG582Jdj/JdMpUua4NS0sZlNkEFxxFnuCOu7sVkYPYS+X+3MInM2Qs/ u+uPPmHNF+YhhCC17nZrg41aPTs3242iB/VkpjHBSAd2cJ4yFKM15EZcFCjzdR3KWnZo awNzhG7vIukRt7qadQG0hsnpPgB1BeKnKmhN8TPerQFWKzNzgY/Mjv0tbB8pVdsKtbff hrJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=5iIanct8; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f7-20020a056a001ac700b0064d56036aeasi4452352pfv.255.2023.07.07.23.50.24; Fri, 07 Jul 2023 23:50:37 -0700 (PDT) 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=@google.com header.s=20221208 header.b=5iIanct8; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229552AbjGHFsf (ORCPT + 99 others); Sat, 8 Jul 2023 01:48:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229462AbjGHFse (ORCPT ); Sat, 8 Jul 2023 01:48:34 -0400 Received: from mail-qt1-x82b.google.com (mail-qt1-x82b.google.com [IPv6:2607:f8b0:4864:20::82b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 719FD1BF for ; Fri, 7 Jul 2023 22:48:33 -0700 (PDT) Received: by mail-qt1-x82b.google.com with SMTP id d75a77b69052e-401f4408955so67431cf.1 for ; Fri, 07 Jul 2023 22:48:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1688795312; x=1691387312; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=mn+nUOxWSZTxZ7OcyeEWmpBqaocgMenrl66gbGB3Jrs=; b=5iIanct8O/4uEsustVHeTjaR+s3tG4eSuSHjxv650mRRhlnGJXKdK9fgu6nNtWsJfk vycVqfA7QnZmeRo/mb5s2KQUPW660U1IAId7eZzCprWJPVhQ+IRiJo58uUOpNo4Z/oNL T8lPIaYd3LWyOKRiLtpHUVAL17w5a/X3OUT7AdbUbjMasjwUz6kr4ga9ihfMZHfrwYW5 MWlzLqg5EH7r2kohuAWIdKU4DjblTqEFsRaUkCNU1y/KfLnf8hcoSnXp1euem8BV5uug qEE8m0QJxoXORnqDa5XbIujURxM2UPqNmIj4z+CwR5dzvMv4zHuGgtkswnI/bi32ll7K Kfcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688795312; x=1691387312; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mn+nUOxWSZTxZ7OcyeEWmpBqaocgMenrl66gbGB3Jrs=; b=Vp4WIAePpQnpouE59wqeI+H6GCUGcWbJ8eLH+5piaJCuRK0vZgN+VIKhYzgdSPiBAG CPk8MDDHHy5qnEXMQ8IVsBtr5TPJZMnmwDIaqIZpGuWv/xLxh6n/dkfwZR3LatF+uvDI HmsiPDfB4B6EpFLXK6jodCYzW1DdXnTgBKAxtOyTmSM6SiuRgD7mefTsnvoleqSGSTqW YcCuEir9o6vP5yg75dxaVDKEo4cUA/H1xLpqhdVjVg8pmr7TFNa9kfImcQCJUc77elIc WHGCpUMfKX96eicfd+n/wyYCJFTmLbK5ck6Iz7qjtg66KW8+wcTwuFuxOvznttFMCgn4 pirA== X-Gm-Message-State: ABy/qLbYGg/mPiTP1w10sGr8CyN2dbyUvCfL4jL/M37cT2ZgA3OP0hpR x5+EyeNUychssK+PCVd4xaJbJKFLHgyG80T7ZzMolw== X-Received: by 2002:ac8:5b09:0:b0:3f8:8c06:c53b with SMTP id m9-20020ac85b09000000b003f88c06c53bmr120199qtw.0.1688795312491; Fri, 07 Jul 2023 22:48:32 -0700 (PDT) MIME-Version: 1.0 References: <20230707165221.4076590-1-fengwei.yin@intel.com> <20230707165221.4076590-2-fengwei.yin@intel.com> In-Reply-To: <20230707165221.4076590-2-fengwei.yin@intel.com> From: Yu Zhao Date: Fri, 7 Jul 2023 23:47:56 -0600 Message-ID: Subject: Re: [RFC PATCH 1/3] mm: add function folio_in_range() To: Yin Fengwei Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, ryan.roberts@arm.com, shy828301@gmail.com, akpm@linux-foundation.org, willy@infradead.org, david@redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 Fri, Jul 7, 2023 at 10:52=E2=80=AFAM Yin Fengwei = wrote: > > It will be used to check whether the folio is mapped to specific > VMA and whether the mapping address of folio is in the range. > > Signed-off-by: Yin Fengwei > --- > mm/internal.h | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > > diff --git a/mm/internal.h b/mm/internal.h > index f1276d90484ad..66117523d7d71 100644 > --- a/mm/internal.h > +++ b/mm/internal.h > @@ -585,6 +585,32 @@ extern long faultin_vma_page_range(struct vm_area_st= ruct *vma, > bool write, int *locked); > extern bool mlock_future_ok(struct mm_struct *mm, unsigned long flags, > unsigned long bytes); > + > +static inline bool > +folio_in_range(struct folio *folio, struct vm_area_struct *vma, > + unsigned long start, unsigned long end) Is there a caller that's not "folio_in_range(folio, vma, vma->vm_start, vma->vm_end)"? If not, then just "folio_within_vma(folio, vma)" or a wrapper on top of folio_in_range().