From: Thomas Gleixner <tglx@linutronix.de>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] intelrdt: resctrl: recommend locking for resctrlfs
Date: Fri, 9 Dec 2016 10:35:20 +0100 (CET) [thread overview]
Message-ID: <alpine.DEB.2.20.1612091033540.3794@nanos> (raw)
In-Reply-To: <20161202220702.GA31213@amt.cnet>
On Fri, 2 Dec 2016, Marcelo Tosatti wrote:
> Actually, using flock(2) allows one to use LOCK_SH for readers and
> this allows consistent writer/reader behaviour (say, a reader
> won't see a partially written directory).
Indeed.
> So the procedure would be:
>
> /var/lock/resctrl/fs.lock created previously in the filesystem.
>
> WRITE LOCK:
>
> A) Take flock(EXCLUSIVE) on /var/lock/resctrl/fs.lock
> B) If success, write pid of the program to the file.
> C) read/write the directory structure.
> D) funlock
>
> READ LOCK:
>
> A) Take flock(SHARED) on /var/lock/resctrl/fs.lock
> B) If success read the directory structure.
> C) funlock
>
>
> How about that?
Looks sane. Adding a small example in C and [ba]sh would be nice.
Thanks,
tglx
next prev parent reply other threads:[~2016-12-09 9:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-30 15:48 [PATCH] " Marcelo Tosatti
2016-11-30 21:10 ` Thomas Gleixner
2016-11-30 22:05 ` Fenghua Yu
2016-11-30 22:25 ` Marcelo Tosatti
2016-12-01 21:54 ` Fenghua Yu
2016-12-01 14:55 ` [PATCH v2] " Marcelo Tosatti
2016-12-02 11:20 ` Thomas Gleixner
2016-12-02 22:07 ` Marcelo Tosatti
2016-12-09 9:35 ` Thomas Gleixner [this message]
2016-12-14 17:08 ` [PATCH v3] " Marcelo Tosatti
2016-12-15 13:49 ` [tip:x86/cache] Documentation, x86, resctrl: Recommend " tip-bot for Marcelo Tosatti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.20.1612091033540.3794@nanos \
--to=tglx@linutronix.de \
--cc=fenghua.yu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mtosatti@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®