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 3E540C433EF for ; Tue, 21 Sep 2021 16:30:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D4E1661131 for ; Tue, 21 Sep 2021 16:30:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D4E1661131 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 5A881940011; Tue, 21 Sep 2021 12:30:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 558B5940007; Tue, 21 Sep 2021 12:30:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 42083940011; Tue, 21 Sep 2021 12:30:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0170.hostedemail.com [216.40.44.170]) by kanga.kvack.org (Postfix) with ESMTP id 2FD73940007 for ; Tue, 21 Sep 2021 12:30:17 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id DB5B32B37F for ; Tue, 21 Sep 2021 16:30:16 +0000 (UTC) X-FDA: 78612118032.12.2A3B300 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf16.hostedemail.com (Postfix) with ESMTP id 76025F00008E for ; Tue, 21 Sep 2021 16:30:16 +0000 (UTC) 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-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-40-8_9WN-coNmqpS4B9UcUhGg-1; Tue, 21 Sep 2021 12:30:14 -0400 X-MC-Unique: 8_9WN-coNmqpS4B9UcUhGg-1 Received: by mail-qk1-f198.google.com with SMTP id t18-20020a05620a0b1200b003f8729fdd04so183241460qkg.5 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=5hWo5CrWy50W0V+pZ3+v1Y26KzEC76OV9YOQwNG1r7dxZG/Pkftk/6d2P9zQMSpdXn FhfQ+CYivLv0Ki0Ul37ru8k9n/ASDOmPPYgyctCbPg7Q7X76UWYh9KEaxBuXDMo+JrrK 79LV1M+22G+blK2q0dxiMGXlnkX697Z1EyRegdxZD6aKf6ho4Xy01XnSizlJJo44ZvRX pJJMOlOvWByTh0VWItPPfsRKE0DmKzkKLmoWnfawc93WHu2/YKW7PkSF12g1DCs9FGws yyTtWWnWcrSqIEOeH59FQdYZxfD6KdZwpALLmXWyvYGslzjfx6pCQkpBQ8bGC8s/cjNf OV5Q== X-Gm-Message-State: AOAM530WPeHafKZRggrNPsfYbhjqImwQwd9FNo1MAg4hvbFVFPWhK9nc 7vL1ZEoN9COzltziOlpzGViHdOseBwGmHMAd/fkUcqPA3QHEkZCM4axSESAJWPxBG5CYnHZi5hv POIt9sIwVFSM= X-Received: by 2002:a37:a152:: with SMTP id k79mr4734849qke.358.1632241814340; 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 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="B2/v4P9x"; spf=none (imf16.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 76025F00008E X-Stat-Signature: kqeu7f9im5mmrpmq6g6mfonwnsbrbike X-HE-Tag: 1632241816-516936 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: 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