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 84FD6C433F5 for ; Fri, 3 Dec 2021 11:56:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E6B316B0072; Fri, 3 Dec 2021 06:55:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DF31C6B0074; Fri, 3 Dec 2021 06:55:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C93DA6B0075; Fri, 3 Dec 2021 06:55:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0040.hostedemail.com [216.40.44.40]) by kanga.kvack.org (Postfix) with ESMTP id B2AAF6B0072 for ; Fri, 3 Dec 2021 06:55:59 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 639D98B74E for ; Fri, 3 Dec 2021 11:55:49 +0000 (UTC) X-FDA: 78876328818.09.D0CE6D9 Received: from so254-9.mailgun.net (so254-9.mailgun.net [198.61.254.9]) by imf07.hostedemail.com (Postfix) with ESMTP id E646110000A7 for ; Fri, 3 Dec 2021 11:55:48 +0000 (UTC) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1638532548; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=bOt1H8z2j6YG1dWnvdF0egJwtTskF4YHLm3gfLlMM9o=; b=DVaYTskfrRa0jxbXJKqup6lwInoh+x0TDtOQKHROAFi9vf4LliKCcI9IfOsXQ2k/HS8HPGrg bxJ+Nt5X+H6weJAfalL2G6/TWwoGIUITIlyHa3Urw32lvFFXRXpyGW0mXd+j+G3yCcPgPoLl xJK5ZYqW11BgHrk2d8lLKGtLR70= X-Mailgun-Sending-Ip: 198.61.254.9 X-Mailgun-Sid: WyIwY2Q3OCIsICJsaW51eC1tbUBrdmFjay5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n06.prod.us-east-1.postgun.com with SMTP id 61aa05c43553c354bec34b75 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 03 Dec 2021 11:55:48 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id E2FDAC4361B; Fri, 3 Dec 2021 11:55:46 +0000 (UTC) Received: from [192.168.29.110] (unknown [49.37.157.144]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: charante) by smtp.codeaurora.org (Postfix) with ESMTPSA id CDF66C4360D; Fri, 3 Dec 2021 11:55:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.codeaurora.org CDF66C4360D Subject: Re: [PATCH v2] mm: shmem: implement POSIX_FADV_[WILL|DONT]NEED for shmem To: Matthew Wilcox Cc: Charan Teja Reddy , hughd@google.com, akpm@linux-foundation.org, vbabka@suse.cz, rientjes@google.com, david@redhat.com, mhocko@suse.com, surenb@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <1638442253-1591-1-git-send-email-quic_charante@quicinc.com> From: Charan Teja Kalla Message-ID: <04ca54ad-0e03-84b1-bf5c-131a582137d4@codeaurora.org> Date: Fri, 3 Dec 2021 17:25:40 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: E646110000A7 X-Stat-Signature: to33tp58c47b4ecoofghd79ps5ik5ygr Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=mg.codeaurora.org header.s=smtp header.b=DVaYTskf; spf=pass (imf07.hostedemail.com: domain of "bounce+d06763.be9e4a-linux-mm=kvack.org@mg.codeaurora.org" designates 198.61.254.9 as permitted sender) smtp.mailfrom="bounce+d06763.be9e4a-linux-mm=kvack.org@mg.codeaurora.org"; dmarc=none X-HE-Tag: 1638532548-538306 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000697, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: () On 12/2/2021 9:24 PM, Matthew Wilcox wrote: > Would this change to the documentation have prevented you from making > this mistake? > > The advanced API is based around the xa_state. This is an opaque data > structure which you declare on the stack using the XA_STATE() > macro. This macro initialises the xa_state ready to start walking > around the XArray. It is used as a cursor to maintain the position > in the XArray and let you compose various operations together without > -having to restart from the top every time. > +having to restart from the top every time. The contents of the xa_state > +are protected by the rcu_read_lock() or the xas_lock(). If you need to > +drop whichever of those locks is protecting your state and tree, you must > +call xas_pause() so that future calls do not rely on the parts of the > +state which were left unprotected. Yes, this looks much clear to me. -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project