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 X-Spam-Level: X-Spam-Status: No, score=-7.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55964C433EF for ; Tue, 21 Sep 2021 16:30:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3B9A261002 for ; Tue, 21 Sep 2021 16:30:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231738AbhIUQbt (ORCPT ); Tue, 21 Sep 2021 12:31:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:49812 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229465AbhIUQbo (ORCPT ); Tue, 21 Sep 2021 12:31:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632241815; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=cvXMhGakfRvwam1AwXwENHJLraWpPC0CvrXKzv+4e2g=; b=B2/v4P9xwRaZMn7dRhy4YiFz+XWspsAv5Nv8U3O9+hgVQBQrcoQGU7XRiLxYQRTgCnOnbp vPGMT91l1yEToyW0WkJIukVUmXLNb0+2IapkxJLuYNqi0Xmd28xl38edWPAuWFkaEtcpnR 6q+jrkikzLHvZ+wWzY/2WB9HCMlRXVE= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-510-1guuNCgKNtSch7tms6NeeA-1; Tue, 21 Sep 2021 12:30:14 -0400 X-MC-Unique: 1guuNCgKNtSch7tms6NeeA-1 Received: by mail-qv1-f69.google.com with SMTP id ci14-20020a056214054e00b0037a75ff56f9so228624191qvb.23 for ; Tue, 21 Sep 2021 09:30:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=cvXMhGakfRvwam1AwXwENHJLraWpPC0CvrXKzv+4e2g=; b=LKHcSGAcKJl5x0HgcxEaeuj9L1q6qZ0l2A9R3VHMAQSoEdSLUjXXiUDX+aO1ZUVVrO wyZOTm4MiALwrTZFlifCNKt5TdMrr4eWcJnIx66FZKrwUw0mqpqNdhfATURHmY8UZfBm 4pPZjdIXSN6gyNgKV60IPRr9pGXz8Lt2YaTbBYiW2WP2XPBtJ+K2DKcqBcAGSVXqFmHY Pp/sG3U4273+eY+pOKFpDRL4lMljPaLOXyP3fX8D2EGLByfbZ5vLo0C5ovAiFIihtEUc pb7kxaRjhsVfynu4FvA4bFGmf0gjn8a9lvdtzeoKGzjgG2CD+/IAH/4yhQ7NvdTf1gd1 ZwyQ== X-Gm-Message-State: AOAM531twRDJfOy877lPZOonr7DWnT+/TiEW1JF1KWxE9Vw0MlvLereW 0IffCzQ1qjZyxMoLg1zcgxi2dZOApfALSKHYwPt0UdIrk8k7rKrWZe5y4KnVYkmTWAc+cdTco/Y 2ZzVgbA9Xb4Bwl/k0u9kuZDEU X-Received: by 2002:a37:a152:: with SMTP id k79mr4734852qke.358.1632241814341; Tue, 21 Sep 2021 09:30:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwA/BiE/VLlRf8pfn0lR/MXGfaprXd3avo4u1T1KPZaeFF4KcokyiBLbt3MnRhkYORRG/A1NA== X-Received: by 2002:a37:a152:: with SMTP id k79mr4734811qke.358.1632241814099; Tue, 21 Sep 2021 09:30:14 -0700 (PDT) Received: from t490s ([2607:fea8:56a2:9100::d3ec]) by smtp.gmail.com with ESMTPSA id r10sm9339894qkk.95.2021.09.21.09.30.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Sep 2021 09:30:13 -0700 (PDT) Date: Tue, 21 Sep 2021 12:30:11 -0400 From: Peter Xu To: Tiberiu Georgescu Cc: Andrew Morton , Jonathan Corbet , "david@redhat.com" , "linux-doc@vger.kernel.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Ivan Teterevkov , Florian Schmidt , "Carl Waldspurger [C]" , Jonathan Davies Subject: Re: [PATCH v2 1/1] Documentation: update pagemap with shmem exceptions Message-ID: References: <20210920164931.175411-1-tiberiu.georgescu@nutanix.com> <20210920164931.175411-2-tiberiu.georgescu@nutanix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 21, 2021 at 04:08:29PM +0000, Tiberiu Georgescu wrote: > Hmmm, so if we put emphasis on the accuracy of swap info, or accuracy in > general, we need to use frontswap. Otherwise, mincore() could suffer from > race conditions, and mark pages in the swap cache as being present. IMHO it's not a race condition, but by design. Quotting again from the mincore() man page: The vec argument must point to an array containing at least (length+PAGE_SIZE-1) / PAGE_SIZE bytes. On return, the least significant bit of each byte will be set if the corresponding page is currently resident in memory, and be clear otherwise. I think "within swap cache" does mean that it still resides in memory, so it's not violating what it's designed to me, at least from the manpage. > > Do you reckon this info (frontswap for mincore) should be present in > the pagemap docs? I wouldn't want to bloat the section either. I don't think the type of swap matters in this document, but imho mentioning mincore() as the alternative to fetch swap is still meaningful as that's what's missing for pagemap right now on shmem typed memories. Even if it cannot identify some cases between "page presents", "page stays in page cache", or "page stays in swap cache", it'll still be good enough to me. Thanks, -- Peter Xu